initial commit
This commit is contained in:
commit
800836b2d9
23 changed files with 609 additions and 0 deletions
66
roles/bootstrap/tasks/main.yml
Normal file
66
roles/bootstrap/tasks/main.yml
Normal file
|
@ -0,0 +1,66 @@
|
|||
---
|
||||
- block:
|
||||
|
||||
- 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:
|
||||
name: "{{ item }}"
|
||||
state: installed
|
||||
with_items:
|
||||
- libselinux-python
|
||||
- sudo
|
||||
when: ansible_distribution in ["CentOS", "Red Hat Enterprise Linux", "Fedora"] and not is_atomic
|
||||
|
||||
- name: enable fastestmirror (fedora - non-atomic)
|
||||
lineinfile:
|
||||
path: /etc/dnf/dnf.conf
|
||||
regexp: "^fastestmirror="
|
||||
line: "fastestmirror=True"
|
||||
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
|
||||
when: is_cloudy
|
||||
|
||||
- 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 }}"
|
||||
|
||||
- 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
|
||||
|
||||
tags:
|
||||
- bootstrap
|
Loading…
Add table
Add a link
Reference in a new issue