updated to fix various bugs
This commit is contained in:
parent
fb8d81317f
commit
af8349b591
@ -11,11 +11,12 @@ Thanks to geerlingguy's iptables role, which is included here to configure the f
|
|||||||
|
|
||||||
####To do:
|
####To do:
|
||||||
|
|
||||||
- Add ubuntu support to client role
|
- Add Ubuntu support to client role
|
||||||
|
- Add Ubuntu
|
||||||
- Update client role to automatically pick EPEL for activation key
|
- Update client role to automatically pick EPEL for activation key
|
||||||
- Look at also adding Debian Jessie/Wheezy
|
- Look at also adding Debian Jessie/Wheezy
|
||||||
|
|
||||||
What /etc/ansible/hosts looks like:
|
What my inventory (/etc/ansible/hosts) looks like:
|
||||||
|
|
||||||
```
|
```
|
||||||
[spacewalk-server]
|
[spacewalk-server]
|
||||||
@ -39,4 +40,6 @@ The prompt will ask for the password to continue.
|
|||||||
####Client:
|
####Client:
|
||||||
```
|
```
|
||||||
ansible-playbook spacewalk-clients.yml
|
ansible-playbook spacewalk-clients.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Extra credits:
|
||||||
|
@ -1,4 +1 @@
|
|||||||
---
|
---
|
||||||
- name: register with spacewalk server
|
|
||||||
command: rhnreg_ks --serverUrl=http://{{ hostvars['spacewalk']['ansible_ssh_host'] }}/XMLRPC --activationkey=1-centos-{{ansible_distribution_major_version}}
|
|
||||||
when: ansible_distribution == "CentOS"
|
|
@ -1,12 +1,16 @@
|
|||||||
---
|
---
|
||||||
- name: install spacewalk repository from URL
|
- name: install spacewalk repository from URL
|
||||||
yum: name=http://yum.spacewalkproject.org/2.4-client/RHEL/{{ansible_distribution_major_version}}/x86_64/spacewalk-client-repo-2.4-3.el{{ansible_distribution_major_version}}.noarch.rpm state=present
|
yum: name=http://yum.spacewalkproject.org/2.4-client/RHEL/{{ansible_distribution_major_version}}/x86_64/spacewalk-client-repo-2.4-3.el{{ansible_distribution_major_version}}.noarch.rpm state=present
|
||||||
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "6"
|
when: ansible_distribution == "CentOS"
|
||||||
|
|
||||||
- name: install extra packages for enterprise linux (EPEL) from URL (CentOS 6)
|
- name: install extra packages for enterprise linux (EPEL) from URL (CentOS 6)
|
||||||
yum: name=http://dl.fedoraproject.org/pub/epel/6/{{ ansible_machine }}/epel-release-6-8.noarch.rpm state=present
|
yum: name=http://dl.fedoraproject.org/pub/epel/6/{{ ansible_machine }}/epel-release-6-8.noarch.rpm state=present
|
||||||
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "6"
|
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "6"
|
||||||
|
|
||||||
|
- name: install extra packages for enterprise linux (EPEL) (CentOS 7)
|
||||||
|
yum: name=epel-release state=present
|
||||||
|
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
|
||||||
|
|
||||||
- name: Install all packages for client
|
- name: Install all packages for client
|
||||||
yum: name={{item}} state=present
|
yum: name={{item}} state=present
|
||||||
with_items:
|
with_items:
|
||||||
@ -19,10 +23,15 @@
|
|||||||
when: ansible_distribution == "CentOS"
|
when: ansible_distribution == "CentOS"
|
||||||
|
|
||||||
- name: Install Spacewalk CA certificate from server
|
- name: Install Spacewalk CA certificate from server
|
||||||
yum: name=http://{{ hostvars['spacewalk']['ansible_ssh_host'] }}/pub/rhn-org-trusted-ssl-cert-1.0-1.noarch.rpm state=present
|
yum:
|
||||||
|
name: http://{{ hostvars['spacewalk']['ansible_ssh_host'] }}/pub/rhn-org-trusted-ssl-cert-1.0-1.noarch.rpm
|
||||||
|
state: present
|
||||||
notify: register with spacewalk server
|
notify: register with spacewalk server
|
||||||
|
|
||||||
- name: register with spacewalk server
|
- name: register with spacewalk server
|
||||||
command: rhnreg_ks --serverUrl=http://{{ hostvars['spacewalk']['ansible_ssh_host'] }}/XMLRPC --activationkey=1-centos-{{ansible_distribution_major_version}}
|
rhn_register:
|
||||||
|
state: present
|
||||||
|
server_url: "http://{{ hostvars['spacewalk']['ansible_ssh_host'] }}/XMLRPC"
|
||||||
|
activationkey: "1-centos-{{ansible_distribution_major_version}}-epel"
|
||||||
when: ansible_distribution == "CentOS"
|
when: ansible_distribution == "CentOS"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
@ -18,12 +18,12 @@
|
|||||||
with_items: "{{ spacewalk_repo_info | union(spacewalk_child_repo_info) }}"
|
with_items: "{{ spacewalk_repo_info | union(spacewalk_child_repo_info) }}"
|
||||||
|
|
||||||
- name: Add activation keys
|
- name: Add activation keys
|
||||||
command: spacecmd --user=admin --password=test123 -- activationkey_create -n {{item.label}} -b {{item.label}} -d {{item.name}}
|
command: spacecmd --user=admin --password={{spacewalk_admin_password}} -- activationkey_create -n {{item.label}} -b {{item.label}} -d {{item.name}}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
with_items: "{{spacewalk_repo_info}}"
|
with_items: "{{spacewalk_repo_info}}"
|
||||||
|
|
||||||
- name: Add activation keys for child channels
|
- name: Add activation keys for child channels
|
||||||
command: spacecmd --user=admin --password=test123 -- activationkey_create -n {{item.label}} -b {{item.parent}} -d {{item.name}}
|
command: spacecmd --user=admin --password={{spacewalk_admin_password}} -- activationkey_create -n {{item.label}} -b {{item.parent}} -d {{item.name}}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
with_items: "{{spacewalk_child_repo_info}}"
|
with_items: "{{spacewalk_child_repo_info}}"
|
||||||
|
|
||||||
@ -32,7 +32,7 @@
|
|||||||
with_items: "{{ spacewalk_repo_info | union(spacewalk_child_repo_info) }}"
|
with_items: "{{ spacewalk_repo_info | union(spacewalk_child_repo_info) }}"
|
||||||
|
|
||||||
- name: Associate child channels with activationkeys
|
- name: Associate child channels with activationkeys
|
||||||
command: spacecmd --user=admin --password=test123 -- activationkey_addchildchannels 1-{{item.label}} {{item.label}}
|
command: spacecmd --user=admin --password={{spacewalk_admin_password}} -- activationkey_addchildchannels 1-{{item.label}} {{item.label}}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
with_items: "{{spacewalk_child_repo_info}}"
|
with_items: "{{spacewalk_child_repo_info}}"
|
||||||
|
|
||||||
|
@ -1,14 +1,20 @@
|
|||||||
---
|
---
|
||||||
- hosts: spacewalk-test-server
|
- hosts: spacewalk-server
|
||||||
sudo: yes
|
sudo: yes
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- hostname: name=spacewalk-test
|
- hostname: name=spacewalk02
|
||||||
roles:
|
roles:
|
||||||
- spacewalk
|
- spacewalk
|
||||||
- { role: iptables, firewall_allowed_tcp_ports: [22, 80, 443, 5222, 5269] }
|
- role: iptables
|
||||||
|
firewall_allowed_tcp_ports:
|
||||||
|
- 22
|
||||||
|
- 80
|
||||||
|
- 443
|
||||||
|
- 5222
|
||||||
|
- 5269
|
||||||
|
|
||||||
|
|
||||||
- hosts: spacewalk-test-server
|
- hosts: spacewalk-server
|
||||||
sudo: yes
|
sudo: yes
|
||||||
|
|
||||||
vars_prompt:
|
vars_prompt:
|
||||||
|
Loading…
Reference in New Issue
Block a user