70 lines
1.8 KiB
YAML
70 lines
1.8 KiB
YAML
---
|
|
# This playbook deploys a development machine
|
|
# EXAMPLE:
|
|
# ansible-playbook -i ${project_dir}/hosts ${project_dir}/playbooks/site.yml \
|
|
# -extra-vars "home_pub_key=<pub-key-location-to-curl> standard_user=<user_name> git_user=<git-user> git_email=<git-email>"
|
|
|
|
- name: Install ansible dependencies
|
|
hosts: all
|
|
user: root
|
|
gather_facts: no
|
|
serial: 100%
|
|
tasks:
|
|
- include: ../roles/ansible-dependencies/tasks/main.yml
|
|
|
|
- name: Apply common configuration to all nodes
|
|
hosts: all
|
|
user: root
|
|
serial: 100%
|
|
tasks:
|
|
- include: ../roles/common/tasks/main.yml
|
|
|
|
- name: Set up developer machine
|
|
hosts: developer-machines
|
|
user: root
|
|
serial: 100%
|
|
tasks:
|
|
- include: ../roles/developer-machine/tasks/main.yml
|
|
|
|
- name: Initialize the swarm
|
|
hosts: swarm-bootstrap
|
|
user: root
|
|
gather_facts: true
|
|
serial: 100%
|
|
vars:
|
|
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
|
|
tasks:
|
|
- include_tasks: ../tasks/swarm-bootstrap.yml
|
|
|
|
- name: Add additional managers to the swarm
|
|
hosts: swarm-managers
|
|
user: root
|
|
gather_facts: false
|
|
serial: 100%
|
|
vars:
|
|
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
|
|
vars:
|
|
join_addr:
|
|
"{{ hostvars[groups['swarm-bootstrap'][0]].ansible_ens18.ipv4.address }}"
|
|
manager_key:
|
|
"{{ hostvars[groups['swarm-bootstrap'][0]]['manager_key']['stdout'] }}"
|
|
tasks:
|
|
- include_tasks: ../tasks/swarm-manager.yml
|
|
|
|
|
|
- name: Add workers to the swarm
|
|
hosts: swarm-workers
|
|
user: root
|
|
gather_facts: false
|
|
serial: 100%
|
|
vars:
|
|
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
|
|
vars:
|
|
join_addr:
|
|
"{{ hostvars[groups['swarm-bootstrap'][0]].ansible_ens18.ipv4.address }}"
|
|
worker_key:
|
|
"{{ hostvars[groups['swarm-bootstrap'][0]]['worker_key']['stdout'] }}"
|
|
tasks:
|
|
- include_tasks: ../tasks/swarm-worker.yml
|
|
|