ansible-experiments/package_updates/base-setup.yml
2018-05-12 14:34:13 +02:00

65 lines
1.6 KiB
YAML

---
- name: install ansible requirements - ubuntu xenial
hosts: ubuntu[1..2]
gather_facts: false
tasks:
- name: install python2 (vagrant images seem to come with python3 only)
raw: apt update && apt install -y python python-apt
- name: install ansible requirements - ubuntu bionic
hosts: ubuntu[3..4]
gather_facts: false
tasks:
- name: install python3-apt
raw: apt install -y python3-apt
- name: install ansible requirements - freebsd
hosts: freebsd*
gather_facts: false
tasks:
- raw: pkg update && pkg install --yes python
- name: install ubuntu1 node as ansible control machine
hosts: ubuntu1
tasks:
- name: install pip
apt:
name:
- python3-pip
- name: install/upgrade Python tools
pip:
name:
- pip
- setuptools
extra_args: --upgrade
- name: install/upgrade ansible dependency
pip:
name:
- cryptography
extra_args: --upgrade
- name: install ansible
pip:
name: ansible
version: 2.5.2
- become_user: vagrant
name: checkout experiments repo on controller node
git:
dest: ./ansible-experiments
repo: https://github.com/stationgroup/ansible-experiments
- become_user: vagrant
name: create ssh key for vagrant user
user:
name: vagrant
generate_ssh_key: true
ssh_key_bits: 4096
ssh_key_file: .ssh/id_rsa
register: vagrant_control_user
- name: distribute vagrant@ubuntu1 ssh key
hosts: all
tasks:
- authorized_key:
key: '{{ hostvars.ubuntu1.vagrant_control_user.ssh_public_key }}'
user: vagrant