2019-02-26 03:49:51 +00:00
|
|
|
---
|
|
|
|
- block:
|
|
|
|
|
2020-04-18 01:36:50 +00:00
|
|
|
- name: gather package facts
|
|
|
|
package_facts:
|
|
|
|
manager: auto
|
|
|
|
|
2019-02-26 03:49:51 +00:00
|
|
|
- name: check if atomic
|
|
|
|
stat:
|
|
|
|
path: /run/ostree-booted
|
|
|
|
register: ostree
|
|
|
|
|
|
|
|
- name: check for cloud.cfg
|
|
|
|
stat:
|
|
|
|
path: /etc/cloud/cloud.cfg
|
|
|
|
register: cloudcfg
|
|
|
|
|
|
|
|
- name: set fact (atomic state)
|
|
|
|
set_fact:
|
|
|
|
is_atomic: "{{ ostree.stat.exists }}"
|
|
|
|
|
|
|
|
- name: set fact (cloud.cfg state)
|
|
|
|
set_fact:
|
|
|
|
is_cloudy: "{{ cloudcfg.stat.exists }}"
|
|
|
|
|
|
|
|
- name: install prereqs
|
|
|
|
package:
|
2020-04-18 01:36:50 +00:00
|
|
|
name: "{{ DEFAULT_PKGS | difference(ansible_facts.packages) }}"
|
2019-02-26 03:49:51 +00:00
|
|
|
state: installed
|
2020-04-18 01:36:50 +00:00
|
|
|
when: (ansible_distribution in ["CentOS", "Red Hat Enterprise Linux", "RedHat", "Fedora"] and not is_atomic)
|
2019-02-26 03:49:51 +00:00
|
|
|
|
2020-06-04 02:11:08 +00:00
|
|
|
- name: disable fastestmirror (fedora - non-atomic)
|
2019-02-26 03:49:51 +00:00
|
|
|
lineinfile:
|
|
|
|
path: /etc/dnf/dnf.conf
|
|
|
|
regexp: "^fastestmirror="
|
2020-06-04 02:11:08 +00:00
|
|
|
line: "fastestmirror=False"
|
|
|
|
when: ansible_distribution in ["Fedora"] and not is_atomic
|
|
|
|
|
|
|
|
- name: dnf - set max_parallel_downloads to 20 (fedora - non-atomic)
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/dnf/dnf.conf
|
|
|
|
regexp: "^max_parallel_downloads="
|
|
|
|
line: "max_parallel_downloads=20"
|
2019-02-26 03:49:51 +00:00
|
|
|
when: ansible_distribution in ["Fedora"] and not is_atomic
|
|
|
|
|
|
|
|
- name: remove update_etc_hosts from cloud.cfg
|
|
|
|
lineinfile:
|
|
|
|
line: ' - update_etc_hosts'
|
|
|
|
path: /etc/cloud/cloud.cfg
|
|
|
|
state: absent
|
2019-06-14 01:15:47 +00:00
|
|
|
when: is_cloudy|bool
|
2019-02-26 03:49:51 +00:00
|
|
|
|
|
|
|
- name: add hosts to /etc/hosts
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/hosts
|
|
|
|
state: present
|
|
|
|
line: "{{ hostvars[item].ip }} {{ hostvars[item].ansible_hostname }}"
|
|
|
|
regexp: "^{{ hostvars[item].ip }} "
|
|
|
|
with_items: "{{ groups.all }}"
|
|
|
|
|
2019-07-31 02:52:28 +00:00
|
|
|
- name: set hostname to match inventory
|
|
|
|
hostname:
|
|
|
|
name: "{{ inventory_hostname }}"
|
|
|
|
register: hostname_change
|
|
|
|
|
2019-02-26 03:49:51 +00:00
|
|
|
- name: remove requiretty
|
|
|
|
lineinfile:
|
|
|
|
regexp: '^\w+\s+requiretty'
|
|
|
|
path: /etc/sudoers
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
- name: install epel
|
|
|
|
package:
|
|
|
|
name: epel-release
|
|
|
|
state: latest
|
|
|
|
when: ansible_distribution in ["CentOS", "Red Hat Enterprise Linux"] and not is_atomic
|
|
|
|
|
2020-04-18 01:36:50 +00:00
|
|
|
- name: remove earlyoom
|
|
|
|
package:
|
|
|
|
name: earlyoom
|
|
|
|
state: absent
|
|
|
|
when: ('earlyoom' in ansible_facts.packages)
|
|
|
|
|
2019-02-26 03:49:51 +00:00
|
|
|
tags:
|
|
|
|
- bootstrap
|