aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2019-02-23 16:27:07 +0000
committerPeter Mikus <pmikus@cisco.com>2019-05-22 09:30:11 +0000
commit04ea580e111ddf5be6101be1fbfe9fde56f1a214 (patch)
tree09247ed50f1da5e09b79dcf41a05b38afeaa4ee2 /resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml
parentc6cd03e08d9429168b0e183b8dcbce991112f279 (diff)
Ansible: Add CIMC/IPMI/COBBLER
- added tasks and handlers for CIMC, IPMI, COBBLER - allows provisioning of servers via COBBLER Change-Id: I64080069260dabb8a6e3b648aeff12f109d3f7c2 Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml')
-rw-r--r--resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml77
1 files changed, 53 insertions, 24 deletions
diff --git a/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml
index d7355883e0..43e83105ce 100644
--- a/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml
@@ -1,29 +1,62 @@
---
# file: roles/common/tasks/main.yaml
+- name: Ensure the system exists in Cobbler
+ cobbler_system:
+ host: '{{ cobbler_hostname }}'
+ port: 60080
+ interfaces:
+ br1:
+ ipaddress: '{{ ansible_default_ipv4.address }}'
+ macaddress: '{{ ansible_default_ipv4.macaddress }}'
+ name: '{{ hostname }}'
+ password: '{{ cobbler_password }}'
+ properties:
+ hostname: '{{ hostname }}'
+ gateway: '{{ ansible_default_ipv4.gateway }}'
+ profile: '{{ cobbler_profile }}'
+ name_servers: '{{ name_servers }}'
+ name_servers_search: '{{ name_servers_search }}'
+ kickstart: '/var/lib/cobbler/kickstarts/{{ cobbler_profile }}.seed'
+ kernel_options: '"interface={{ ansible_default_ipv4.interface }}"'
+ netboot_enabled: yes
+ username: '{{ cobbler_username }}'
+ use_ssl: no
+ validate_certs: no
+ when: provision_enabled
+ delegate_to: localhost
+ tags: cobbler-include
+
+- name: Commit Cobbler changes
+ cobbler_sync:
+ host: '{{ cobbler_hostname }}'
+ port: 60080
+ password: '{{ cobbler_password }}'
+ username: '{{ cobbler_username }}'
+ use_ssl: no
+ validate_certs: no
+ run_once: yes
+ when: provision_enabled
+ delegate_to: localhost
+ register: __included_in_cobbler
+ notify:
+ - 'Boot from network'
+ - 'Reboot server'
+ tags: cobbler-include
+
+- meta: flush_handlers
+
- name: Add permanent proxy settings
lineinfile:
- path: "/etc/environment"
- state: "present"
- line: "{{ item.key }}={{ item.value }}"
- with_dict: "{{ proxy_env }}"
+ path: '/etc/environment'
+ state: 'present'
+ line: '{{ item.key }}={{ item.value }}'
+ with_dict: '{{ proxy_env }}'
when: proxy_env is defined
- name: Install distribution - release - machine prerequisites
include_tasks: '{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml'
-- name: Set hostname
- hostname:
- name: '{{ hostname }}'
- tags: set-hostname
-
-- name: Ensure hostname is in /etc/hosts
- lineinfile:
- path: '/etc/hosts'
- regexp: '^{{ ansible_default_ipv4.address }}.+$'
- line: '{{ ansible_default_ipv4.address }} {{ hostname }}.{{ name_servers_search }}'
- tags: set-hostname
-
- name: Set sudoers admin
lineinfile:
path: '/etc/sudoers'
@@ -49,13 +82,9 @@
owner: 'root'
group: 'root'
mode: '644'
- notify: ['Update GRUB']
+ notify:
+ - 'Update GRUB'
+ - 'Reboot server'
tags: copy-grub
-- name: Add permanent proxy settings
- lineinfile:
- path: "/etc/environment"
- state: "present"
- line: "{{ item.key }}={{ item.value }}"
- with_dict: "{{ proxy_env }}"
- when: proxy_env is defined
+- meta: flush_handlers