You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.4 KiB
71 lines
1.4 KiB
- name: Install packages
|
|
apt:
|
|
name: [ 'gnupg2', 'curl', 'rsync' ]
|
|
|
|
- name: Add the ansible key.
|
|
apt_key:
|
|
keyserver: keyserver.ubuntu.com
|
|
id: 93C4A3FD7BB9C367
|
|
|
|
- name: Install ansible.list for apt.
|
|
copy:
|
|
dest: /etc/apt/sources.list.d/ansible.list
|
|
content: "deb http://ppa.launchpad.net/ansible/ansible/ubuntu focal main"
|
|
owner: root
|
|
group: root
|
|
mode: 0755
|
|
|
|
- name: Reload apt with new source
|
|
apt:
|
|
name: "*"
|
|
state: latest
|
|
update_cache: yes
|
|
|
|
- name: Install packages
|
|
apt:
|
|
name: [
|
|
'ansible',
|
|
'ansible-core',
|
|
'podman',
|
|
]
|
|
state: present
|
|
|
|
- name: Install ansible roles for deployment
|
|
copy:
|
|
src: "{{ role_path }}/files/ansible/"
|
|
dest: "/etc/ansible"
|
|
mode: '0644'
|
|
directory_mode: '0755'
|
|
owner: 'root'
|
|
group: 'root'
|
|
|
|
- name: "Delete /etc/ansible/hosts."
|
|
file:
|
|
path: /etc/ansible/hosts
|
|
state: absent
|
|
|
|
- name: "Create /etc/ansible/hosts."
|
|
copy:
|
|
dest: /etc/ansible/hosts
|
|
content: "[webservers]"
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
|
|
- name: "Add hosts to /etc/ansible/hosts"
|
|
lineinfile:
|
|
path: /etc/ansible/hosts
|
|
line: "{{ item }}"
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
with_items: "{{ deploy_addresses }}"
|
|
|
|
- name: "Install SSH Key for manager to use ansible"
|
|
copy:
|
|
dest: /home/manager/.ssh/id_rsa
|
|
src: "{{ inventory_dir }}/files/ssh/id_rsa"
|
|
owner: manager
|
|
group: manager
|
|
mode: 0600
|
|
|
|
|