-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add playbook pbench agent bootstrap and
pbench_agent install
- Loading branch information
Showing
13 changed files
with
273 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
[defaults] | ||
host_key_checking = false | ||
inventory = ~/.infrared/.workspaces/active/hosts | ||
timeout = 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,34 @@ | ||
--- | ||
guest_image_name: pbench_image | ||
# user can add the guest_image required below | ||
# user can add the guest_image url required below | ||
guest_images: | ||
pbench_image: | ||
name: pbench_image | ||
url: http://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2 | ||
url_centos8: http://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2 | ||
url_centos7: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2 | ||
type: qcow2 | ||
convert_to_raw: false | ||
|
||
# user can specify the hypervisor on which he wants to create client and server vm's | ||
hypervisor_hostnames: [ 'compute-0.redhat.local', 'compute-1.redhat.local'] | ||
# rhel 8 | ||
epel_repo: | ||
el8: https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm | ||
el7: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm | ||
|
||
pbench_image_rhel: false | ||
|
||
compute_names: ['compute-0', 'compute-1' ] | ||
|
||
#name for the client and server | ||
vm_names: [ client, server ] | ||
|
||
user_dir: /home/stack | ||
overcloudrc: /home/stack/overcloudrc | ||
|
||
stackrc: /home/stack/stackrc | ||
# port names | ||
ports: [ 'client_port', 'server_port'] | ||
|
||
dns_nameserver: 10.1.32.3 | ||
|
||
timeout: 30 | ||
|
||
# update the values to install pbench agent | ||
#pbench_key_url: | ||
#pbench_config_url: | ||
#pbench_configuration_environment: "production" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
# | ||
# Playbook for installing pbench_bootstrap | ||
# | ||
# Usage: | ||
# ansible-playbook pbench_agent_bootstrap.yml -e "repos=<perf-dept-repo>" | ||
|
||
- hosts: compute | ||
tasks: | ||
- name: copy the keys | ||
shell: | | ||
sudo cp -r ~/.ssh /root/ | ||
- hosts: undercloud | ||
gather_facts: yes | ||
tasks: | ||
- name: clone perf-dept | ||
shell: | | ||
GIT_SSL_NO_VERIFY=true git clone {{ repos }} | ||
ignore_errors: yes | ||
|
||
- name: get computes ip | ||
shell: | | ||
. {{ stackrc }} | ||
nova list | grep {{ item }} | cut -d \| -f 7 |cut -d \= -f 2 | awk '{$1=$1;print}' | ||
register: computes_ip | ||
with_items: | ||
- "{{ compute_names }}" | ||
|
||
- name: get floating ip of server and client | ||
shell: | | ||
. {{ overcloudrc }} | ||
openstack server list | grep {{ item }} | cut -d \| -f 5 | cut -d \, -f 2 | awk '{$1=$1;print}' | ||
register: vms_fip | ||
with_items: | ||
- "{{ vm_names }}" | ||
|
||
- name: copy the keys | ||
shell: | | ||
sudo cp -r ~/.ssh /root/ | ||
- name: create inventories | ||
file: | ||
path: "{{ user_dir }}/.config/Inventories/" | ||
state: directory | ||
|
||
- name: generate a inventory | ||
template: | ||
src: repo_bootstrap.hosts.j2 | ||
dest: "{{ user_dir }}/.config/Inventories/repo-bootstrap.hosts" | ||
|
||
- name: run repo-bootstrap.yml | ||
shell: | | ||
ansible-playbook --user=root -i "{{ user_dir}}/.config/Inventories/repo-bootstrap.hosts" repo-bootstrap.yml | ||
register: repo_bootstrap | ||
args: | ||
chdir: "{{ user_dir }}/perf-dept/sysadmin/Ansible" | ||
- debug: | ||
msg: "{{ repo_bootstrap }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
--- | ||
# | ||
# Playbook for pbench agent installations | ||
# Usage: | ||
# ansible-playbook pbench_agent_install.yml | ||
|
||
- hosts: compute | ||
gather_facts: yes | ||
tasks: | ||
- name: install latest epel-release | ||
yum: | ||
name: "{{ epel_repo.el7 }}" | ||
state: present | ||
become: yes | ||
loop: | ||
- "{{ epel_repo.el7 }}" | ||
- perl-Data-UUID | ||
when: ansible_distribution_major_version < '8' | ||
|
||
- name: install perl-Data-UUID on Compute nodes | ||
dnf: | ||
name: perl-Data-UUID | ||
state: present | ||
when: ansible_distribution_major_version == '8' | ||
|
||
- hosts: undercloud | ||
vars: | ||
pbench_agent_install: true | ||
|
||
tasks: | ||
- block: | ||
- name: remove old epel-release | ||
yum: | ||
name: "{{item }}" | ||
state: absent | ||
become: yes | ||
ignore_errors: yes | ||
loop: | ||
- epel-release | ||
- ansible | ||
|
||
- name: install latest epel-release | ||
yum: | ||
name: "{{ epel_repo.el7 }}" | ||
state: present | ||
become: yes | ||
|
||
- name: install ansible 2.9 | ||
yum: | ||
name: ansible | ||
state: present | ||
become: yes | ||
|
||
when: ansible_distribution_major_version < '8' | ||
|
||
|
||
- name: Install the pbench-agent roles from Galaxy | ||
shell: | | ||
ansible-galaxy collection install pbench.agent | ||
export ANSIBLE_ROLES_PATH=$HOME/.ansible/collections/ansible_collections/pbench/agent/roles:$ANSIBLE_ROLES_PATH | ||
- name: generate pbench agent playbook | ||
template: | ||
src: pbench_agent_install.yml.j2 | ||
dest: "{{ user_dir }}/.ansible/collections/ansible_collections/pbench/agent/roles/pbench_agent_install.yml" | ||
|
||
- name: get computes ip | ||
shell: | | ||
. {{ stackrc }} | ||
nova list | grep {{ item }} | cut -d \| -f 7 |cut -d \= -f 2 | awk '{$1=$1;print}' | ||
register: computes_ip | ||
with_items: | ||
- "{{ compute_names }}" | ||
|
||
- name: get floating ip of server and client | ||
shell: | | ||
. {{ overcloudrc }} | ||
openstack server list | grep {{ item }} | cut -d \| -f 5 | cut -d \, -f 2 | awk '{$1=$1;print}' | ||
register: vms_fip | ||
with_items: | ||
- "{{ vm_names }}" | ||
|
||
- name: create a inventory file | ||
template: | ||
src: repo_bootstrap.hosts.j2 | ||
dest: "{{ user_dir }}/.config/myhosts.inv" | ||
|
||
- name: run the playbook pbench_agent_install.yml | ||
shell: | | ||
ansible-playbook -i ~/.config/myhosts.inv pbench_agent_install.yml | ||
register: agent_install | ||
args: | ||
chdir: "{{ user_dir }}/.ansible/collections/ansible_collections/pbench/agent/roles/" | ||
- debug: | ||
msg: "{{ agent_install }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
--- | ||
- name: create a vm's on specified hypervisors | ||
shell: . {{ overcloudrc }}; openstack server create --hypervisor-hostname {{ item[0] }} --flavor pbench_flavor --image {{ guest_image_name }} --nic port-id={{ item[1].stdout }} --user-data /home/stack/pass_auth.sh {{ item[2] }} | ||
- name: create a vm's | ||
shell: . {{ overcloudrc }}; openstack server create --flavor pbench_flavor --image {{ guest_image_name }} --nic port-id={{ item[0].stdout }} --user-data {{ user_dir }}/pass_auth.sh {{ item[1] }} | ||
with_together: | ||
- "{{ hypervisor_hostnames }}" | ||
- "{{ port_ids }}" | ||
- "{{ port_ids.results }}" | ||
- "{{ vm_names }}" | ||
ignore_errors: yes | ||
|
||
- name: create a vm's | ||
shell: . {{ overcloudrc }}; openstack server create --flavor pbench_flavor --image {{ guest_image_name }} --nic port-id={{ item[0].stdout }} --user-data {{ user_dir }}/pass_auth.sh {{ item[1] }} | ||
with_together: | ||
- "{{ get_port_ids.results }}" | ||
- "{{ vm_names }}" | ||
ignore_errors: yes | ||
|
||
|
||
- name: wait for vm to boot | ||
wait_for: | ||
timeout: "{{ timeout }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.