diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-08-09 13:53:32 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-08-09 14:23:12 +0300 |
commit | 9862863b21558fdf646aebb5578a5d7f963946c0 (patch) | |
tree | ec59f05995b5cc7952108058a62d918408249f3c | |
parent | "etckeeper" role is a dependency (diff) | |
download | maintenance-9862863b21558fdf646aebb5578a5d7f963946c0.tar.gz maintenance-9862863b21558fdf646aebb5578a5d7f963946c0.zip |
add "server" role
-rw-r--r-- | maintenance.yml | 1 | ||||
-rw-r--r-- | roles/server/defaults/main.yml | 1 | ||||
-rw-r--r-- | roles/server/tasks/main.yml | 23 |
3 files changed, 25 insertions, 0 deletions
diff --git a/maintenance.yml b/maintenance.yml index 7092530..cb2c80b 100644 --- a/maintenance.yml +++ b/maintenance.yml @@ -4,6 +4,7 @@ - snap - apt - pacman + - server - docker - flatpak - vagrant diff --git a/roles/server/defaults/main.yml b/roles/server/defaults/main.yml new file mode 100644 index 0000000..eda8336 --- /dev/null +++ b/roles/server/defaults/main.yml @@ -0,0 +1 @@ +server_dir: '{{ ansible_env.HOME }}/server' diff --git a/roles/server/tasks/main.yml b/roles/server/tasks/main.yml new file mode 100644 index 0000000..05ef180 --- /dev/null +++ b/roles/server/tasks/main.yml @@ -0,0 +1,23 @@ +- name: 'Check if {{ server_dir }}/docker-compose.yml exists' + stat: + path: '{{ server_dir }}/docker-compose.yml' + register: server_exists + +- when: server_exists.stat.exists + become: true + block: + # community.docker.docker_compose is too confusing for me to use, sorry. + - name: docker-compose pull + command: docker-compose pull --quiet + args: + chdir: '{{ server_dir }}' + + - name: docker-compose build + command: docker-compose build --pull + args: + chdir: '{{ server_dir }}' + + - name: docker-compose up + command: docker-compose up -d + args: + chdir: '{{ server_dir }}' |