diff options
| author | EuAndreh <eu@euandre.org> | 2019-06-05 16:38:53 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2019-06-05 16:42:06 -0300 |
| commit | 54fd61c887f266f8e2e6b1419a86fc6681116069 (patch) | |
| tree | 74a9923d75be46dad6c967acd271cdb5d80fca45 /provision.yaml | |
| parent | Use =nix build= instead of =nix-build= (diff) | |
| download | server-54fd61c887f266f8e2e6b1419a86fc6681116069.tar.gz server-54fd61c887f266f8e2e6b1419a86fc6681116069.tar.xz | |
Use Ansible instead of Bash for provisioning
The deployment is not quite working, and I'm unable to test right now:
DigitalOcean is returning 503 for my requests.
As of this commit, I can run =ansible-playbook provider.yml= more than once and
it will actually be idempotent.
Notes:
- SSH fingerprint are now taken from the public key file instead of manually
supplying it in the terraform template using the =digitalocean_ssh_key=
resource;
- use Ansible instead of ad-hoc Bash scripts for provisioning the Droplets
created by Terraform;
- use the =filename.env.extension= to create the concrete files in CI;
- use the =user_data= to add the know SSH key pair to the newly created Droplet;
- add =rotate-ssh-keys.sh= utils;
Diffstat (limited to '')
| -rw-r--r-- | provision.yaml | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/provision.yaml b/provision.yaml new file mode 100644 index 0000000..d23bbc9 --- /dev/null +++ b/provision.yaml @@ -0,0 +1,31 @@ +--- +- hosts: all + gather_facts: no + pre_tasks: + - name: Install Python 2 for Ansible fact gathering + raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal) + +- hosts: all + tasks: + - name: Update Ubuntu server + apt: + update_cache: yes + upgrade: dist + - name: Install docker-compose + apt: + name: docker-compose + state: latest + - name: Create /home/vps/ base directory + file: + path: /home/vps/ + state: directory + - name: Copy file + copy: src={{ item.src }} dest={{ item.dest }} + with_items: + - { src: './scripts/box/bash-profile.sh', dest: '/etc/profile.d/bash-profile.sh' } + - { src: './docker-compose.yaml', dest: '/home/vps/docker-compose.yaml' } + - name: Start docker-compose + docker_service: + project_src: /home/vps/ + pull: yes + state: present |
