-
Notifications
You must be signed in to change notification settings - Fork 98
/
exercise123-bak.yaml
59 lines (57 loc) · 1.47 KB
/
exercise123-bak.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
- name: add host to inventory
vars_prompt:
- name: newhost
prompt: "specify name of new host"
- name: newhostip
prompt: "enter new host IP address"
hosts: localhost
tasks:
- name: add new host to inventory
lineinfile:
path: inventory
state: present
line: "{{ newhost }}"
- name: add new host to /etc/hosts
lineinfile:
path: /etc/hosts
state: present
line: "{{ newhostip }} {{ newhost }}"
tags: addhost
- name: configure a new RHEL host
hosts: ansible5
remote_user: root
become: false
tasks:
- name: configure user ansible
user:
name: ansible
groups: wheel
append: yes
state: present
- name: set a password for this user
shell: 'echo password | passwd --stdin ansible'
- name: enable sudo without passwords
lineinfile:
path: /etc/sudoers
regexp: '^%wheel'
line: '%wheel ALL=(ALL) NOPASSWD: ALL'
validate: /usr/sbin/visudo -cf %s
tags: setuphost
- name: use subscription manager to register and set up repos
hosts: ansible5
vars_files:
- lesson12-vault.yaml
tasks:
- name: register and subscribe {{ newhost }}
redhat_subscription:
username: "{{ rhsm_user }}"
password: "{{ rhsm_password }}"
state: present
- name: configure additional repo access
rhsm_repository:
name:
- rh-gluster-3-client-for-rhel-8-x86_64-rpms
- rhel-8-for-x86_64-appstream-debug-rpms
state: present
tags: registerhost