algo/deploy_client.yml

50 lines
1.4 KiB
YAML
Raw Normal View History

2017-03-03 17:46:11 +00:00
- name: Configure the client
hosts: localhost
2017-03-04 20:05:02 +00:00
vars_files:
- config.cfg
2017-03-03 17:46:11 +00:00
tasks:
- name: Add the droplet to an inventory group
add_host:
name: "{{ client_ip }}"
groups: client-host
2017-03-04 20:05:02 +00:00
ansible_ssh_user: "{{ server_ssh_user }}"
vpn_user: "{{ vpn_user }}"
server_ip: "{{ server_ip }}"
2017-03-03 17:46:11 +00:00
- name: Configure the client and install required software
hosts: client-host
gather_facts: false
become: true
vars_files:
- config.cfg
pre_tasks:
- name: Get the OS
raw: uname -a
register: distribution
2017-03-04 20:05:02 +00:00
- name: Modify the server name fact
set_fact:
IP_subject_alt_name: "{{ server_ip }}"
- name: Ubuntu Xenial | Install prerequisites
2017-03-03 17:46:11 +00:00
raw: >
test -x /usr/bin/python2.7 ||
sudo apt-get update -qq && sudo apt-get install -qq -y python2.7 &&
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
changed_when: false
when: "'ubuntu' in distribution.stdout"
2017-03-04 20:05:02 +00:00
- name: Fedora 25 | Install prerequisites
raw: >
test -x /usr/bin/python2.7 ||
sudo dnf install python2 -y &&
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 &&
rpm -ql python2-dnf || dnf install python2-dnf -y
changed_when: false
when: "'fedora' in distribution.stdout"
2017-03-03 17:46:11 +00:00
roles:
- { role: client, tags: ['client'] }