From 80b7266ed1b10fb302a507d250d28a964ce14e49 Mon Sep 17 00:00:00 2001 From: SamYaple Date: Fri, 29 Jan 2016 16:40:54 +0000 Subject: Rename kolla_ansible to kolla_toolbox This change is needed for clarity. We have a kolla-ansible script. We have a kolla-mesos repo. We plan to have a kolla-ansible repo. Already we have had far too much confusion about whether we are talking about the container or the project. Naming this kolla-toolbox eliminates all of that confusion and its probably a bit more accurate of a name too. Closes-Bug: #1541053 Change-Id: I8fd1f49d5a22b36ede5b10f46b9fe02ddda9007e --- ansible/roles/ceph/tasks/bootstrap_osds.yml | 4 +- ansible/roles/ceph/tasks/start_osds.yml | 2 +- ansible/roles/cinder/tasks/bootstrap.yml | 4 +- ansible/roles/cinder/tasks/register.yml | 6 +- ansible/roles/common/defaults/main.yml | 2 +- ansible/roles/common/tasks/pull.yml | 2 +- ansible/roles/common/tasks/start.yml | 4 +- ansible/roles/common/templates/rsyslog.conf.j2 | 4 +- ansible/roles/glance/tasks/bootstrap.yml | 4 +- ansible/roles/glance/tasks/check.yml | 2 +- ansible/roles/glance/tasks/register.yml | 4 +- ansible/roles/heat/tasks/bootstrap.yml | 4 +- ansible/roles/heat/tasks/register.yml | 6 +- ansible/roles/ironic/tasks/bootstrap.yml | 4 +- ansible/roles/ironic/tasks/register.yml | 4 +- ansible/roles/keystone/tasks/bootstrap.yml | 4 +- ansible/roles/keystone/tasks/check.yml | 2 +- ansible/roles/keystone/tasks/register.yml | 4 +- ansible/roles/magnum/tasks/bootstrap.yml | 4 +- ansible/roles/magnum/tasks/register.yml | 4 +- ansible/roles/mariadb/tasks/register.yml | 2 +- ansible/roles/mistral/tasks/bootstrap.yml | 4 +- ansible/roles/mistral/tasks/register.yml | 4 +- ansible/roles/murano/tasks/bootstrap.yml | 4 +- ansible/roles/murano/tasks/register.yml | 4 +- ansible/roles/neutron/tasks/bootstrap.yml | 4 +- ansible/roles/neutron/tasks/register.yml | 4 +- ansible/roles/nova/tasks/bootstrap.yml | 4 +- ansible/roles/nova/tasks/register.yml | 4 +- ansible/roles/swift/tasks/register.yml | 4 +- docker/kolla-ansible/Dockerfile.j2 | 62 ------------- docker/kolla-ansible/ansible.cfg | 2 - docker/kolla-ansible/find_disks.py | 115 ------------------------- docker/kolla-ansible/kolla_keystone_service.py | 86 ------------------ docker/kolla-ansible/kolla_keystone_user.py | 88 ------------------- docker/kolla-ansible/kolla_sanity.py | 63 -------------- docker/kolla-ansible/kolla_zookeeper.py | 66 -------------- docker/kolla-toolbox/Dockerfile.j2 | 62 +++++++++++++ docker/kolla-toolbox/ansible.cfg | 2 + docker/kolla-toolbox/find_disks.py | 115 +++++++++++++++++++++++++ docker/kolla-toolbox/kolla_keystone_service.py | 86 ++++++++++++++++++ docker/kolla-toolbox/kolla_keystone_user.py | 88 +++++++++++++++++++ docker/kolla-toolbox/kolla_sanity.py | 63 ++++++++++++++ docker/kolla-toolbox/kolla_zookeeper.py | 66 ++++++++++++++ kolla/common/config.py | 6 +- tools/cleanup-containers | 2 +- 46 files changed, 542 insertions(+), 542 deletions(-) delete mode 100644 docker/kolla-ansible/Dockerfile.j2 delete mode 100644 docker/kolla-ansible/ansible.cfg delete mode 100644 docker/kolla-ansible/find_disks.py delete mode 100644 docker/kolla-ansible/kolla_keystone_service.py delete mode 100644 docker/kolla-ansible/kolla_keystone_user.py delete mode 100644 docker/kolla-ansible/kolla_sanity.py delete mode 100644 docker/kolla-ansible/kolla_zookeeper.py create mode 100644 docker/kolla-toolbox/Dockerfile.j2 create mode 100644 docker/kolla-toolbox/ansible.cfg create mode 100644 docker/kolla-toolbox/find_disks.py create mode 100644 docker/kolla-toolbox/kolla_keystone_service.py create mode 100644 docker/kolla-toolbox/kolla_keystone_user.py create mode 100644 docker/kolla-toolbox/kolla_sanity.py create mode 100644 docker/kolla-toolbox/kolla_zookeeper.py diff --git a/ansible/roles/ceph/tasks/bootstrap_osds.yml b/ansible/roles/ceph/tasks/bootstrap_osds.yml index 7cd143a3f..723d54a27 100644 --- a/ansible/roles/ceph/tasks/bootstrap_osds.yml +++ b/ansible/roles/ceph/tasks/bootstrap_osds.yml @@ -1,6 +1,6 @@ --- - name: Looking up disks to bootstrap for Ceph - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m find_disks -a "partition_name='KOLLA_CEPH_OSD_BOOTSTRAP'" register: osd_lookup @@ -12,7 +12,7 @@ osds_bootstrap: "{{ (osd_lookup.stdout.split('localhost | SUCCESS => ')[1]|from_json).disks|from_json }}" - name: Looking up disks to bootstrap for Ceph - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m find_disks -a "partition_name='KOLLA_CEPH_OSD_CACHE_BOOTSTRAP'" register: osd_cache_lookup diff --git a/ansible/roles/ceph/tasks/start_osds.yml b/ansible/roles/ceph/tasks/start_osds.yml index 151a28856..1324fd80e 100644 --- a/ansible/roles/ceph/tasks/start_osds.yml +++ b/ansible/roles/ceph/tasks/start_osds.yml @@ -1,6 +1,6 @@ --- - name: Looking up OSDs for Ceph - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m find_disks -a "partition_name='KOLLA_CEPH_DATA'" register: osd_lookup diff --git a/ansible/roles/cinder/tasks/bootstrap.yml b/ansible/roles/cinder/tasks/bootstrap.yml index be7966d56..bf17ab6c3 100644 --- a/ansible/roles/cinder/tasks/bootstrap.yml +++ b/ansible/roles/cinder/tasks/bootstrap.yml @@ -1,6 +1,6 @@ --- - name: Creating Cinder database - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' login_user='{{ database_user }}' @@ -18,7 +18,7 @@ database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" - name: Creating Cinder database user and setting permissions - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' login_user='{{ database_user }}' diff --git a/ansible/roles/cinder/tasks/register.yml b/ansible/roles/cinder/tasks/register.yml index aeb2e937d..31f887cca 100644 --- a/ansible/roles/cinder/tasks/register.yml +++ b/ansible/roles/cinder/tasks/register.yml @@ -1,6 +1,6 @@ --- - name: Creating the Cinder service and endpoint - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_service -a "service_name=cinder service_type=volume @@ -20,7 +20,7 @@ run_once: True - name: Creating the Cinder v2 service and endpoint - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_service -a "service_name=cinderv2 service_type=volumev2 @@ -40,7 +40,7 @@ run_once: True - name: Creating the Cinder project, user, and role - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_user -a "project=service user=cinder diff --git a/ansible/roles/common/defaults/main.yml b/ansible/roles/common/defaults/main.yml index e3895f118..7cf4384c5 100644 --- a/ansible/roles/common/defaults/main.yml +++ b/ansible/roles/common/defaults/main.yml @@ -6,7 +6,7 @@ common_run: False #################### # Docker #################### -ansible_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-kolla-ansible" +ansible_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-kolla-toolbox" ansible_tag: "{{ openstack_release }}" ansible_image_full: "{{ ansible_image }}:{{ ansible_tag }}" diff --git a/ansible/roles/common/tasks/pull.yml b/ansible/roles/common/tasks/pull.yml index 1bd963bb8..c5ebeb621 100644 --- a/ansible/roles/common/tasks/pull.yml +++ b/ansible/roles/common/tasks/pull.yml @@ -5,7 +5,7 @@ common_options: "{{ docker_common_options }}" image: "{{ rsyslog_image_full }}" -- name: Pulling kolla-ansible image +- name: Pulling kolla-toolbox image kolla_docker: action: "pull_image" common_options: "{{ docker_common_options }}" diff --git a/ansible/roles/common/tasks/start.yml b/ansible/roles/common/tasks/start.yml index bbe9de2ce..cb36fe2db 100644 --- a/ansible/roles/common/tasks/start.yml +++ b/ansible/roles/common/tasks/start.yml @@ -11,7 +11,7 @@ - "/var/lib/kolla/dev:/dev" - "rsyslog:/var/log" -- name: Starting kolla-ansible container +- name: Starting kolla-toolbox container kolla_docker: action: "start_container" common_options: "{{ docker_common_options }}" @@ -19,7 +19,7 @@ ANSIBLE_NOCOLOR: "1" ANSIBLE_LIBRARY: "/usr/share/ansible" image: "{{ ansible_image_full }}" - name: "kolla_ansible" + name: "kolla_toolbox" privileged: True volumes: - "/dev/:/dev/" diff --git a/ansible/roles/common/templates/rsyslog.conf.j2 b/ansible/roles/common/templates/rsyslog.conf.j2 index 280ff5ba9..fd5df492f 100644 --- a/ansible/roles/common/templates/rsyslog.conf.j2 +++ b/ansible/roles/common/templates/rsyslog.conf.j2 @@ -6,8 +6,8 @@ $KLogPermitNonKernelFacility on $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat $RepeatedMsgReduction on -$template KollaAnsibleFile,"/var/log/kolla_ansible.log" -:syslogtag,contains,"ansible" ?KollaAnsibleFile +$template KollaToolboxFile,"/var/log/kolla_toolbox.log" +:syslogtag,contains,"toolbox" ?KollaToolboxFile $template GlanceApiFile,"/var/log/glance/glance_api.log" :syslogtag,contains,"glance-api" ?GlanceApiFile diff --git a/ansible/roles/glance/tasks/bootstrap.yml b/ansible/roles/glance/tasks/bootstrap.yml index 2ac9b696f..800a04e54 100644 --- a/ansible/roles/glance/tasks/bootstrap.yml +++ b/ansible/roles/glance/tasks/bootstrap.yml @@ -1,6 +1,6 @@ --- - name: Creating Glance database - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' login_user='{{ database_user }}' @@ -19,7 +19,7 @@ database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" - name: Creating Glance database user and setting permissions - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' login_user='{{ database_user }}' diff --git a/ansible/roles/glance/tasks/check.yml b/ansible/roles/glance/tasks/check.yml index 73303b2ec..0ce7bf547 100644 --- a/ansible/roles/glance/tasks/check.yml +++ b/ansible/roles/glance/tasks/check.yml @@ -1,7 +1,7 @@ --- - name: Glance sanity checks - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_sanity -a "service=glance project=service diff --git a/ansible/roles/glance/tasks/register.yml b/ansible/roles/glance/tasks/register.yml index f5655e63e..905eba8a0 100644 --- a/ansible/roles/glance/tasks/register.yml +++ b/ansible/roles/glance/tasks/register.yml @@ -1,6 +1,6 @@ --- - name: Creating the Glance service and endpoint - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_service -a "service_name=glance service_type=image @@ -20,7 +20,7 @@ run_once: True - name: Creating the Glance project, user, and role - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_user -a "project=service user=glance diff --git a/ansible/roles/heat/tasks/bootstrap.yml b/ansible/roles/heat/tasks/bootstrap.yml index ccf0cc234..fa6fde538 100644 --- a/ansible/roles/heat/tasks/bootstrap.yml +++ b/ansible/roles/heat/tasks/bootstrap.yml @@ -1,6 +1,6 @@ --- - name: Creating Heat database - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' login_user='{{ database_user }}' @@ -18,7 +18,7 @@ database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" - name: Creating Heat database user and setting permissions - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' login_user='{{ database_user }}' diff --git a/ansible/roles/heat/tasks/register.yml b/ansible/roles/heat/tasks/register.yml index 3cd89b94b..d6fd4d71d 100644 --- a/ansible/roles/heat/tasks/register.yml +++ b/ansible/roles/heat/tasks/register.yml @@ -1,6 +1,6 @@ --- - name: Creating the Heat service and endpoint - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_service -a "service_name=heat service_type=orchestration @@ -20,7 +20,7 @@ run_once: True - name: Creating the Heat-cfn service and endpoint - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_service -a "service_name=heat-cfn service_type=orchestration @@ -40,7 +40,7 @@ run_once: True - name: Creating the Heat project, user, and role - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_user -a "project=service user=heat diff --git a/ansible/roles/ironic/tasks/bootstrap.yml b/ansible/roles/ironic/tasks/bootstrap.yml index 4a4b9ee4b..3f7ceca5f 100644 --- a/ansible/roles/ironic/tasks/bootstrap.yml +++ b/ansible/roles/ironic/tasks/bootstrap.yml @@ -1,6 +1,6 @@ --- - name: Creating Ironic database - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' login_port='{{ mariadb_port }}' @@ -19,7 +19,7 @@ database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" - name: Creating Ironic database user and setting permissions - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' login_port='{{ mariadb_port }}' diff --git a/ansible/roles/ironic/tasks/register.yml b/ansible/roles/ironic/tasks/register.yml index 518fa3a49..c1862b1d7 100644 --- a/ansible/roles/ironic/tasks/register.yml +++ b/ansible/roles/ironic/tasks/register.yml @@ -1,6 +1,6 @@ --- - name: Creating the Ironic service and endpoint - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_service -a "service_name=ironic service_type=baremetal @@ -20,7 +20,7 @@ run_once: True - name: Creating the Ironic project, user, and role - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_user -a "project=service user={{ ironic_keystone_user }} diff --git a/ansible/roles/keystone/tasks/bootstrap.yml b/ansible/roles/keystone/tasks/bootstrap.yml index dc1ecd626..1694cdb79 100644 --- a/ansible/roles/keystone/tasks/bootstrap.yml +++ b/ansible/roles/keystone/tasks/bootstrap.yml @@ -1,6 +1,6 @@ --- - name: Creating Keystone database - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' login_port='{{ mariadb_port }}' @@ -19,7 +19,7 @@ database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" - name: Creating Keystone database user and setting permissions - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' login_port='{{ mariadb_port }}' diff --git a/ansible/roles/keystone/tasks/check.yml b/ansible/roles/keystone/tasks/check.yml index 328a5e387..53842721b 100644 --- a/ansible/roles/keystone/tasks/check.yml +++ b/ansible/roles/keystone/tasks/check.yml @@ -1,7 +1,7 @@ --- - name: Keystone sanity checks - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_sanity -a "service=keystone project=service diff --git a/ansible/roles/keystone/tasks/register.yml b/ansible/roles/keystone/tasks/register.yml index a401624cf..a20d6c422 100644 --- a/ansible/roles/keystone/tasks/register.yml +++ b/ansible/roles/keystone/tasks/register.yml @@ -1,6 +1,6 @@ --- - name: Creating the admin project, user and role - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_user -a "project=admin user=admin @@ -18,7 +18,7 @@ run_once: True - name: Creating the Keystone service and endpoint - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_service -a "service_name=keystone service_type=identity diff --git a/ansible/roles/magnum/tasks/bootstrap.yml b/ansible/roles/magnum/tasks/bootstrap.yml index 09bc61961..21a4f9698 100644 --- a/ansible/roles/magnum/tasks/bootstrap.yml +++ b/ansible/roles/magnum/tasks/bootstrap.yml @@ -1,6 +1,6 @@ --- - name: Creating Magnum database - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' login_user='{{ database_user }}' @@ -18,7 +18,7 @@ database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" - name: Creating Magnum database user and setting permissions - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' login_user='{{ database_user }}' diff --git a/ansible/roles/magnum/tasks/register.yml b/ansible/roles/magnum/tasks/register.yml index aff9c38b2..a89a124fb 100644 --- a/ansible/roles/magnum/tasks/register.yml +++ b/ansible/roles/magnum/tasks/register.yml @@ -1,6 +1,6 @@ --- - name: Creating the Magnum service and endpoint - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_service -a "service_name=magnum service_type=container @@ -20,7 +20,7 @@ run_once: True - name: Creating the Magnum project, user, and role - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_user -a "project=service user=magnum diff --git a/ansible/roles/mariadb/tasks/register.yml b/ansible/roles/mariadb/tasks/register.yml index 0aa72d2c3..279e4cb61 100644 --- a/ansible/roles/mariadb/tasks/register.yml +++ b/ansible/roles/mariadb/tasks/register.yml @@ -1,6 +1,6 @@ --- - name: Creating haproxy mysql user - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}' login_port='{{ mariadb_port }}' diff --git a/ansible/roles/mistral/tasks/bootstrap.yml b/ansible/roles/mistral/tasks/bootstrap.yml index ec2f251e2..ce267ebfd 100644 --- a/ansible/roles/mistral/tasks/bootstrap.yml +++ b/ansible/roles/mistral/tasks/bootstrap.yml @@ -1,6 +1,6 @@ --- - name: Creating Mistral database - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' login_user='{{ database_user }}' @@ -19,7 +19,7 @@ database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" - name: Creating Mistral database user and setting permissions - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' login_user='{{ database_user }}' diff --git a/ansible/roles/mistral/tasks/register.yml b/ansible/roles/mistral/tasks/register.yml index fe1059d51..5ffbaf1b5 100644 --- a/ansible/roles/mistral/tasks/register.yml +++ b/ansible/roles/mistral/tasks/register.yml @@ -1,6 +1,6 @@ --- - name: Creating the Mistral service and endpoint - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_service -a "service_name=mistral service_type=application_catalog @@ -20,7 +20,7 @@ run_once: True - name: Creating the Mistral project, user, and role - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_user -a "project=service user=mistral diff --git a/ansible/roles/murano/tasks/bootstrap.yml b/ansible/roles/murano/tasks/bootstrap.yml index 0d07a0cec..695700ea9 100644 --- a/ansible/roles/murano/tasks/bootstrap.yml +++ b/ansible/roles/murano/tasks/bootstrap.yml @@ -1,6 +1,6 @@ --- - name: Creating Murano database - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' login_user='{{ database_user }}' @@ -19,7 +19,7 @@ database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" - name: Creating Murano database user and setting permissions - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' login_user='{{ database_user }}' diff --git a/ansible/roles/murano/tasks/register.yml b/ansible/roles/murano/tasks/register.yml index c1ea88daf..2d99fa083 100644 --- a/ansible/roles/murano/tasks/register.yml +++ b/ansible/roles/murano/tasks/register.yml @@ -1,6 +1,6 @@ --- - name: Creating the Murano service and endpoint - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_service -a "service_name=murano service_type=application_catalog @@ -20,7 +20,7 @@ run_once: True - name: Creating the Murano project, user, and role - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_user -a "project=service user=murano diff --git a/ansible/roles/neutron/tasks/bootstrap.yml b/ansible/roles/neutron/tasks/bootstrap.yml index ba63dc685..9eba99be1 100644 --- a/ansible/roles/neutron/tasks/bootstrap.yml +++ b/ansible/roles/neutron/tasks/bootstrap.yml @@ -1,6 +1,6 @@ --- - name: Creating Neutron database - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' login_user='{{ database_user }}' @@ -18,7 +18,7 @@ database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" - name: Creating Neutron database user and setting permissions - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' login_user='{{ database_user }}' diff --git a/ansible/roles/neutron/tasks/register.yml b/ansible/roles/neutron/tasks/register.yml index 221e3de59..2c2c56be8 100644 --- a/ansible/roles/neutron/tasks/register.yml +++ b/ansible/roles/neutron/tasks/register.yml @@ -1,6 +1,6 @@ --- - name: Creating the Neutron service and endpoint - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_service -a "service_name=neutron service_type=network @@ -20,7 +20,7 @@ run_once: True - name: Creating the Neutron project, user, and role - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_user -a "project=service user=neutron diff --git a/ansible/roles/nova/tasks/bootstrap.yml b/ansible/roles/nova/tasks/bootstrap.yml index 9f874efd5..647e6c54c 100644 --- a/ansible/roles/nova/tasks/bootstrap.yml +++ b/ansible/roles/nova/tasks/bootstrap.yml @@ -1,6 +1,6 @@ --- - name: Creating Nova database - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' login_user='{{ database_user }}' @@ -18,7 +18,7 @@ database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" - name: Creating Nova database user and setting permissions - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' login_user='{{ database_user }}' diff --git a/ansible/roles/nova/tasks/register.yml b/ansible/roles/nova/tasks/register.yml index 8a82319f2..43f475d63 100644 --- a/ansible/roles/nova/tasks/register.yml +++ b/ansible/roles/nova/tasks/register.yml @@ -1,6 +1,6 @@ --- - name: Creating the Nova service and endpoint - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_service -a "service_name=nova service_type=compute @@ -21,7 +21,7 @@ - name: Creating the Nova project, user, and role - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_user -a "project=service user=nova diff --git a/ansible/roles/swift/tasks/register.yml b/ansible/roles/swift/tasks/register.yml index d2d61dd76..f26156893 100644 --- a/ansible/roles/swift/tasks/register.yml +++ b/ansible/roles/swift/tasks/register.yml @@ -1,6 +1,6 @@ --- - name: Creating the Swift service and endpoint - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_service -a "service_name=swift service_type=object-store @@ -20,7 +20,7 @@ run_once: True - name: Creating the Swift project, user, and role - command: docker exec -t kolla_ansible /usr/bin/ansible localhost + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m kolla_keystone_user -a "project=service user={{ swift_keystone_user }} diff --git a/docker/kolla-ansible/Dockerfile.j2 b/docker/kolla-ansible/Dockerfile.j2 deleted file mode 100644 index fe80db693..000000000 --- a/docker/kolla-ansible/Dockerfile.j2 +++ /dev/null @@ -1,62 +0,0 @@ -FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }} -MAINTAINER {{ maintainer }} - -{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} - -# TODO(mandre) remove MariaDB-shared once Percona has fixed its packaging issue -RUN yum -y install \ - gcc \ - git \ - libffi-devel \ - libxml2-devel \ - libxslt-devel \ - mariadb-devel \ - mariadb-libs \ - MariaDB-shared \ - openssl-devel \ - python-devel \ - openssh-clients \ - && yum clean all - -{% elif base_distro in ['ubuntu', 'debian'] %} - -RUN apt-get -y --no-install-recommends install \ - build-essential \ - ca-certificates \ - git \ - libffi-dev \ - libmariadbclient-dev \ - libssl-dev \ - libxslt1-dev \ - python-dev \ - && apt-get clean - -{% endif %} - -RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ - && python get-pip.py \ - && rm get-pip.py \ - && pip --no-cache-dir install --upgrade wheel \ - && pip --no-cache-dir install \ - MySQL-python \ - os-client-config==1.13.1 \ - pyudev \ - shade==1.3.0 - -RUN git clone --depth 1 -b v2.0.0-0.7.rc2 https://github.com/ansible/ansible.git \ - && cd ansible \ - && git submodule update --init --recursive \ - && pip --no-cache-dir install . - -RUN mkdir -p /etc/ansible /usr/share/ansible /home/ansible \ - && echo 'localhost ansible_connection=local' > /etc/ansible/hosts \ - && useradd --user-group ansible --groups kolla - -COPY find_disks.py kolla_keystone_service.py kolla_keystone_user.py kolla_sanity.py kolla_zookeeper.py /usr/share/ansible/ -COPY ansible.cfg /home/ansible/.ansible.cfg - -CMD ["/bin/sleep", "infinity"] - -{{ include_footer }} - -USER ansible diff --git a/docker/kolla-ansible/ansible.cfg b/docker/kolla-ansible/ansible.cfg deleted file mode 100644 index c45b65ae1..000000000 --- a/docker/kolla-ansible/ansible.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[defaults] -remote_tmp = /tmp diff --git a/docker/kolla-ansible/find_disks.py b/docker/kolla-ansible/find_disks.py deleted file mode 100644 index 6ebf2b6a2..000000000 --- a/docker/kolla-ansible/find_disks.py +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/python - -# Copyright 2015 Sam Yaple -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This module has been relicensed from the source below: -# https://github.com/SamYaple/yaodu/blob/master/ansible/library/ceph_osd_list - -DOCUMENTATION = ''' ---- -module: find_disks -short_description: Return list of devices containing a specfied name or label -description: - - This will return a list of all devices with either GPT partition name - or filesystem label of the name specified. -options: - match_mode: - description: - - Label match mode, either strict or prefix - default: 'strict' - required: False - choices: [ "strict", "prefix" ] - type: str - name: - description: - - Partition name or filesystem label - required: True - type: str - aliases: [ 'partition_name' ] -author: Sam Yaple -''' - -EXAMPLES = ''' -- hosts: ceph-osd - tasks: - - name: Return all valid formated devices with the name KOLLA_CEPH_OSD - find_disks: - name: 'KOLLA_CEPH_OSD' - register: osds - -- hosts: swift-object-server - tasks: - - name: Return all valid devices with the name KOLLA_SWIFT - find_disks: - name: 'KOLLA_SWIFT' - register: swift_disks - -- hosts: swift-object-server - tasks: - - name: Return all valid devices with wildcard name 'swift_d*' - find_disks: - name: 'swift_d' match_mode: 'prefix' - register: swift_disks -''' - -import json -import pyudev - - -def main(): - argument_spec = dict( - match_mode=dict(required=False, choices=['strict', 'prefix'], - default='strict'), - name=dict(aliases=['partition_name'], required=True, type='str') - ) - module = AnsibleModule(argument_spec) - match_mode = module.params.get('match_mode') - name = module.params.get('name') - - def is_dev_matched_by_name(dev, name): - if dev.get('DEVTYPE', '') == 'partition': - dev_name = dev.get('ID_PART_ENTRY_NAME', '') - else: - dev_name = dev.get('ID_FS_LABEL', '') - - if match_mode == 'strict': - return dev_name == name - elif match_mode == 'prefix': - return dev_name.startswith(name) - else: - return False - - try: - ret = list() - ct = pyudev.Context() - for dev in ct.list_devices(subsystem='block'): - if is_dev_matched_by_name(dev, name): - fs_uuid = dev.get('ID_FS_UUID', '') - fs_label = dev.get('ID_FS_LABEL', '') - if dev.get('DEVTYPE', '') == 'partition': - device_node = dev.find_parent('block').device_node - else: - device_node = dev.device_node - ret.append({'device': device_node, - 'fs_uuid': fs_uuid, - 'fs_label': fs_label}) - module.exit_json(disks=json.dumps(ret)) - except Exception as e: - module.exit_json(failed=True, msg=repr(e)) - -# import module snippets -from ansible.module_utils.basic import * # noqa -if __name__ == '__main__': - main() diff --git a/docker/kolla-ansible/kolla_keystone_service.py b/docker/kolla-ansible/kolla_keystone_service.py deleted file mode 100644 index 7c03d00e1..000000000 --- a/docker/kolla-ansible/kolla_keystone_service.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/python - -# Copyright 2015 Sam Yaple -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This file is a barebones file needed to file a gap until Ansible 2.0. No -# error checking, no deletions, no updates. Idempotent creation only. - -# If you look closely, you will see we arent _really_ using the shade module -# we just use it to slightly abstract the authentication model. As patches land -# in upstream shade we will be able to use more of the shade module. Until then -# if we want to be 'stable' we really need to be using it as a passthrough - -import shade - - -def main(): - argument_spec = openstack_full_argument_spec( - description=dict(required=True, type='str'), - service_name=dict(required=True, type='str'), - service_type=dict(required=True, type='str'), - admin_url=dict(required=True, type='str'), - internal_url=dict(required=True, type='str'), - public_url=dict(required=True, type='str'), - endpoint_region=dict(required=True, type='str') - ) - module = AnsibleModule(argument_spec) - - try: - description = module.params.pop('description') - service_name = module.params.pop('service_name') - service_type = module.params.pop('service_type') - admin_url = module.params.pop('admin_url') - internal_url = module.params.pop('internal_url') - public_url = module.params.pop('public_url') - endpoint_region = module.params.pop('endpoint_region') - - changed = False - service = None - endpoint = None - - cloud = shade.operator_cloud(**module.params) - - for _service in cloud.keystone_client.services.list(): - if _service.type == service_type: - service = _service - - if service is not None: - for _endpoint in cloud.keystone_client.endpoints.list(): - if _endpoint.service_id == service.id: - endpoint = _endpoint - else: - service = cloud.keystone_client.services.create( - name=service_name, - service_type=service_type, - description=description) - - if endpoint is None: - changed = True - cloud.keystone_client.endpoints.create( - service_id=service.id, - adminurl=admin_url, - internalurl=internal_url, - publicurl=public_url, - region=endpoint_region) - - module.exit_json(changed=changed) - except Exception as e: - module.exit_json(failed=True, changed=True, msg=e) - -# import module snippets -from ansible.module_utils.basic import * # noqa -from ansible.module_utils.openstack import * # noqa -if __name__ == '__main__': - main() diff --git a/docker/kolla-ansible/kolla_keystone_user.py b/docker/kolla-ansible/kolla_keystone_user.py deleted file mode 100644 index 2d1a739c5..000000000 --- a/docker/kolla-ansible/kolla_keystone_user.py +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/python - -# Copyright 2015 Sam Yaple -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This file is a barebones file needed to file a gap until Ansible 2.0. No -# error checking, no deletions, no updates. Idempotent creation only. - -# If you look closely, you will see we arent _really_ using the shade module -# we just use it to slightly abstract the authentication model. As patches land -# in upstream shade we will be able to use more of the shade module. Until then -# if we want to be 'stable' we really need to be using it as a passthrough - -import shade - - -def main(): - argument_spec = openstack_full_argument_spec( - password=dict(required=True, type='str'), - project=dict(required=True, type='str'), - role=dict(required=True, type='str'), - user=dict(required=True, type='str') - ) - module = AnsibleModule(argument_spec) - - try: - password = module.params.pop('password') - project_name = module.params.pop('project') - role_name = module.params.pop('role') - user_name = module.params.pop('user') - - changed = False - project = None - role = None - user = None - - cloud = shade.operator_cloud(**module.params) - - for _project in cloud.keystone_client.tenants.list(): - if _project.name == project_name: - project = _project - - for _role in cloud.keystone_client.roles.list(): - if _role.name == role_name: - role = _role - - for _user in cloud.keystone_client.users.list(): - if _user.name == user_name: - user = _user - - if not project: - changed = True - project = cloud.keystone_client.tenants.create( - tenant_name=project_name) - - if not role: - changed = True - role = cloud.keystone_client.roles.create(name=role_name) - - if not user: - changed = True - user = cloud.keystone_client.users.create(name=user_name, - password=password, - tenant_id=project.id) - cloud.keystone_client.roles.add_user_role(role=role.id, - user=user.id, - tenant=project.id) - - module.exit_json(changed=changed) - except Exception as e: - module.exit_json(failed=True, changed=True, msg=e) - -# import module snippets -from ansible.module_utils.basic import * # noqa -from ansible.module_utils.openstack import * # noqa -if __name__ == '__main__': - main() diff --git a/docker/kolla-ansible/kolla_sanity.py b/docker/kolla-ansible/kolla_sanity.py deleted file mode 100644 index 7f4eea9fc..000000000 --- a/docker/kolla-ansible/kolla_sanity.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/python - -# Copyright 2015 Intel corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This file is a barebones file needed to file a gap until Ansible 2.0. No -# error checking, no deletions, no updates. Idempotent creation only. - -# If you look closely, you will see we arent _really_ using the shade module -# we just use it to slightly abstract the authentication model. As patches land -# in upstream shade we will be able to use more of the shade module. Until then -# if we want to be 'stable' we really need to be using it as a passthrough - -import shade - - -class SanityChecks(object): - @staticmethod - def keystone(cloud): - [tenant for tenant in cloud.keystone_client.tenants.list()] - - @staticmethod - def glance(cloud): - [image for image in cloud.glance_client.images.list()] - - -def main(): - module = AnsibleModule( - argument_spec=openstack_full_argument_spec( - password=dict(required=True, type='str'), - project=dict(required=True, type='str'), - role=dict(required=True, type='str'), - user=dict(required=True, type='str'), - service=dict(required=True, type='str'), - ) - ) - - try: - changed = True - cloud = shade.operator_cloud(**module.params) - - getattr(SanityChecks, module.params.pop("service"))(cloud) - - module.exit_json(changed=changed) - except Exception as e: - module.exit_json(failed=True, changed=True, msg=e) - -# import module snippets -from ansible.module_utils.basic import * # noqa -from ansible.module_utils.openstack import * # noqa -if __name__ == '__main__': - main() diff --git a/docker/kolla-ansible/kolla_zookeeper.py b/docker/kolla-ansible/kolla_zookeeper.py deleted file mode 100644 index d6326f46a..000000000 --- a/docker/kolla-ansible/kolla_zookeeper.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/python - -# Copyright 2015 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import contextlib - -import kazoo.client -import kazoo.exceptions - - -@contextlib.contextmanager -def zk_connection(zk_host, zk_port): - zk = kazoo.client.KazooClient(hosts='{}:{}'.format(zk_host, zk_port)) - zk.start() - yield zk - zk.stop() - - -def main(): - module = AnsibleModule( - argument_spec=dict( - zk_host=dict(required=True, type='str'), - zk_port=dict(required=True, type='str'), - path=dict(required=True, type='str'), - value=dict(required=False, default=None, type='str') - ) - ) - - try: - zk_host = module.params.pop('zk_host') - zk_port = module.params.pop('zk_port') - path = module.params.pop('path') - value = module.params.pop('value') - - changed = False - with zk_connection(zk_host, zk_port) as zk: - try: - zk.get(path) - except kazoo.exceptions.NoNodeError: - if value is None: - zk.create(path, makepath=True) - else: - zk.create(path, value=value.encode(), makepath=True) - changed = True - - module.exit_json(changed=changed) - except Exception as e: - module.exit_json(failed=True, changed=True, msg=e) - - -# import module snippets -from ansible.module_utils.basic import * # noqa -if __name__ == '__main__': - main() diff --git a/docker/kolla-toolbox/Dockerfile.j2 b/docker/kolla-toolbox/Dockerfile.j2 new file mode 100644 index 000000000..fe80db693 --- /dev/null +++ b/docker/kolla-toolbox/Dockerfile.j2 @@ -0,0 +1,62 @@ +FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} + +# TODO(mandre) remove MariaDB-shared once Percona has fixed its packaging issue +RUN yum -y install \ + gcc \ + git \ + libffi-devel \ + libxml2-devel \ + libxslt-devel \ + mariadb-devel \ + mariadb-libs \ + MariaDB-shared \ + openssl-devel \ + python-devel \ + openssh-clients \ + && yum clean all + +{% elif base_distro in ['ubuntu', 'debian'] %} + +RUN apt-get -y --no-install-recommends install \ + build-essential \ + ca-certificates \ + git \ + libffi-dev \ + libmariadbclient-dev \ + libssl-dev \ + libxslt1-dev \ + python-dev \ + && apt-get clean + +{% endif %} + +RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ + && python get-pip.py \ + && rm get-pip.py \ + && pip --no-cache-dir install --upgrade wheel \ + && pip --no-cache-dir install \ + MySQL-python \ + os-client-config==1.13.1 \ + pyudev \ + shade==1.3.0 + +RUN git clone --depth 1 -b v2.0.0-0.7.rc2 https://github.com/ansible/ansible.git \ + && cd ansible \ + && git submodule update --init --recursive \ + && pip --no-cache-dir install . + +RUN mkdir -p /etc/ansible /usr/share/ansible /home/ansible \ + && echo 'localhost ansible_connection=local' > /etc/ansible/hosts \ + && useradd --user-group ansible --groups kolla + +COPY find_disks.py kolla_keystone_service.py kolla_keystone_user.py kolla_sanity.py kolla_zookeeper.py /usr/share/ansible/ +COPY ansible.cfg /home/ansible/.ansible.cfg + +CMD ["/bin/sleep", "infinity"] + +{{ include_footer }} + +USER ansible diff --git a/docker/kolla-toolbox/ansible.cfg b/docker/kolla-toolbox/ansible.cfg new file mode 100644 index 000000000..c45b65ae1 --- /dev/null +++ b/docker/kolla-toolbox/ansible.cfg @@ -0,0 +1,2 @@ +[defaults] +remote_tmp = /tmp diff --git a/docker/kolla-toolbox/find_disks.py b/docker/kolla-toolbox/find_disks.py new file mode 100644 index 000000000..6ebf2b6a2 --- /dev/null +++ b/docker/kolla-toolbox/find_disks.py @@ -0,0 +1,115 @@ +#!/usr/bin/python + +# Copyright 2015 Sam Yaple +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This module has been relicensed from the source below: +# https://github.com/SamYaple/yaodu/blob/master/ansible/library/ceph_osd_list + +DOCUMENTATION = ''' +--- +module: find_disks +short_description: Return list of devices containing a specfied name or label +description: + - This will return a list of all devices with either GPT partition name + or filesystem label of the name specified. +options: + match_mode: + description: + - Label match mode, either strict or prefix + default: 'strict' + required: False + choices: [ "strict", "prefix" ] + type: str + name: + description: + - Partition name or filesystem label + required: True + type: str + aliases: [ 'partition_name' ] +author: Sam Yaple +''' + +EXAMPLES = ''' +- hosts: ceph-osd + tasks: + - name: Return all valid formated devices with the name KOLLA_CEPH_OSD + find_disks: + name: 'KOLLA_CEPH_OSD' + register: osds + +- hosts: swift-object-server + tasks: + - name: Return all valid devices with the name KOLLA_SWIFT + find_disks: + name: 'KOLLA_SWIFT' + register: swift_disks + +- hosts: swift-object-server + tasks: + - name: Return all valid devices with wildcard name 'swift_d*' + find_disks: + name: 'swift_d' match_mode: 'prefix' + register: swift_disks +''' + +import json +import pyudev + + +def main(): + argument_spec = dict( + match_mode=dict(required=False, choices=['strict', 'prefix'], + default='strict'), + name=dict(aliases=['partition_name'], required=True, type='str') + ) + module = AnsibleModule(argument_spec) + match_mode = module.params.get('match_mode') + name = module.params.get('name') + + def is_dev_matched_by_name(dev, name): + if dev.get('DEVTYPE', '') == 'partition': + dev_name = dev.get('ID_PART_ENTRY_NAME', '') + else: + dev_name = dev.get('ID_FS_LABEL', '') + + if match_mode == 'strict': + return dev_name == name + elif match_mode == 'prefix': + return dev_name.startswith(name) + else: + return False + + try: + ret = list() + ct = pyudev.Context() + for dev in ct.list_devices(subsystem='block'): + if is_dev_matched_by_name(dev, name): + fs_uuid = dev.get('ID_FS_UUID', '') + fs_label = dev.get('ID_FS_LABEL', '') + if dev.get('DEVTYPE', '') == 'partition': + device_node = dev.find_parent('block').device_node + else: + device_node = dev.device_node + ret.append({'device': device_node, + 'fs_uuid': fs_uuid, + 'fs_label': fs_label}) + module.exit_json(disks=json.dumps(ret)) + except Exception as e: + module.exit_json(failed=True, msg=repr(e)) + +# import module snippets +from ansible.module_utils.basic import * # noqa +if __name__ == '__main__': + main() diff --git a/docker/kolla-toolbox/kolla_keystone_service.py b/docker/kolla-toolbox/kolla_keystone_service.py new file mode 100644 index 000000000..7c03d00e1 --- /dev/null +++ b/docker/kolla-toolbox/kolla_keystone_service.py @@ -0,0 +1,86 @@ +#!/usr/bin/python + +# Copyright 2015 Sam Yaple +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This file is a barebones file needed to file a gap until Ansible 2.0. No +# error checking, no deletions, no updates. Idempotent creation only. + +# If you look closely, you will see we arent _really_ using the shade module +# we just use it to slightly abstract the authentication model. As patches land +# in upstream shade we will be able to use more of the shade module. Until then +# if we want to be 'stable' we really need to be using it as a passthrough + +import shade + + +def main(): + argument_spec = openstack_full_argument_spec( + description=dict(required=True, type='str'), + service_name=dict(required=True, type='str'), + service_type=dict(required=True, type='str'), + admin_url=dict(required=True, type='str'), + internal_url=dict(required=True, type='str'), + public_url=dict(required=True, type='str'), + endpoint_region=dict(required=True, type='str') + ) + module = AnsibleModule(argument_spec) + + try: + description = module.params.pop('description') + service_name = module.params.pop('service_name') + service_type = module.params.pop('service_type') + admin_url = module.params.pop('admin_url') + internal_url = module.params.pop('internal_url') + public_url = module.params.pop('public_url') + endpoint_region = module.params.pop('endpoint_region') + + changed = False + service = None + endpoint = None + + cloud = shade.operator_cloud(**module.params) + + for _service in cloud.keystone_client.services.list(): + if _service.type == service_type: + service = _service + + if service is not None: + for _endpoint in cloud.keystone_client.endpoints.list(): + if _endpoint.service_id == service.id: + endpoint = _endpoint + else: + service = cloud.keystone_client.services.create( + name=service_name, + service_type=service_type, + description=description) + + if endpoint is None: + changed = True + cloud.keystone_client.endpoints.create( + service_id=service.id, + adminurl=admin_url, + internalurl=internal_url, + publicurl=public_url, + region=endpoint_region) + + module.exit_json(changed=changed) + except Exception as e: + module.exit_json(failed=True, changed=True, msg=e) + +# import module snippets +from ansible.module_utils.basic import * # noqa +from ansible.module_utils.openstack import * # noqa +if __name__ == '__main__': + main() diff --git a/docker/kolla-toolbox/kolla_keystone_user.py b/docker/kolla-toolbox/kolla_keystone_user.py new file mode 100644 index 000000000..2d1a739c5 --- /dev/null +++ b/docker/kolla-toolbox/kolla_keystone_user.py @@ -0,0 +1,88 @@ +#!/usr/bin/python + +# Copyright 2015 Sam Yaple +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This file is a barebones file needed to file a gap until Ansible 2.0. No +# error checking, no deletions, no updates. Idempotent creation only. + +# If you look closely, you will see we arent _really_ using the shade module +# we just use it to slightly abstract the authentication model. As patches land +# in upstream shade we will be able to use more of the shade module. Until then +# if we want to be 'stable' we really need to be using it as a passthrough + +import shade + + +def main(): + argument_spec = openstack_full_argument_spec( + password=dict(required=True, type='str'), + project=dict(required=True, type='str'), + role=dict(required=True, type='str'), + user=dict(required=True, type='str') + ) + module = AnsibleModule(argument_spec) + + try: + password = module.params.pop('password') + project_name = module.params.pop('project') + role_name = module.params.pop('role') + user_name = module.params.pop('user') + + changed = False + project = None + role = None + user = None + + cloud = shade.operator_cloud(**module.params) + + for _project in cloud.keystone_client.tenants.list(): + if _project.name == project_name: + project = _project + + for _role in cloud.keystone_client.roles.list(): + if _role.name == role_name: + role = _role + + for _user in cloud.keystone_client.users.list(): + if _user.name == user_name: + user = _user + + if not project: + changed = True + project = cloud.keystone_client.tenants.create( + tenant_name=project_name) + + if not role: + changed = True + role = cloud.keystone_client.roles.create(name=role_name) + + if not user: + changed = True + user = cloud.keystone_client.users.create(name=user_name, + password=password, + tenant_id=project.id) + cloud.keystone_client.roles.add_user_role(role=role.id, + user=user.id, + tenant=project.id) + + module.exit_json(changed=changed) + except Exception as e: + module.exit_json(failed=True, changed=True, msg=e) + +# import module snippets +from ansible.module_utils.basic import * # noqa +from ansible.module_utils.openstack import * # noqa +if __name__ == '__main__': + main() diff --git a/docker/kolla-toolbox/kolla_sanity.py b/docker/kolla-toolbox/kolla_sanity.py new file mode 100644 index 000000000..7f4eea9fc --- /dev/null +++ b/docker/kolla-toolbox/kolla_sanity.py @@ -0,0 +1,63 @@ +#!/usr/bin/python + +# Copyright 2015 Intel corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This file is a barebones file needed to file a gap until Ansible 2.0. No +# error checking, no deletions, no updates. Idempotent creation only. + +# If you look closely, you will see we arent _really_ using the shade module +# we just use it to slightly abstract the authentication model. As patches land +# in upstream shade we will be able to use more of the shade module. Until then +# if we want to be 'stable' we really need to be using it as a passthrough + +import shade + + +class SanityChecks(object): + @staticmethod + def keystone(cloud): + [tenant for tenant in cloud.keystone_client.tenants.list()] + + @staticmethod + def glance(cloud): + [image for image in cloud.glance_client.images.list()] + + +def main(): + module = AnsibleModule( + argument_spec=openstack_full_argument_spec( + password=dict(required=True, type='str'), + project=dict(required=True, type='str'), + role=dict(required=True, type='str'), + user=dict(required=True, type='str'), + service=dict(required=True, type='str'), + ) + ) + + try: + changed = True + cloud = shade.operator_cloud(**module.params) + + getattr(SanityChecks, module.params.pop("service"))(cloud) + + module.exit_json(changed=changed) + except Exception as e: + module.exit_json(failed=True, changed=True, msg=e) + +# import module snippets +from ansible.module_utils.basic import * # noqa +from ansible.module_utils.openstack import * # noqa +if __name__ == '__main__': + main() diff --git a/docker/kolla-toolbox/kolla_zookeeper.py b/docker/kolla-toolbox/kolla_zookeeper.py new file mode 100644 index 000000000..d6326f46a --- /dev/null +++ b/docker/kolla-toolbox/kolla_zookeeper.py @@ -0,0 +1,66 @@ +#!/usr/bin/python + +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import contextlib + +import kazoo.client +import kazoo.exceptions + + +@contextlib.contextmanager +def zk_connection(zk_host, zk_port): + zk = kazoo.client.KazooClient(hosts='{}:{}'.format(zk_host, zk_port)) + zk.start() + yield zk + zk.stop() + + +def main(): + module = AnsibleModule( + argument_spec=dict( + zk_host=dict(required=True, type='str'), + zk_port=dict(required=True, type='str'), + path=dict(required=True, type='str'), + value=dict(required=False, default=None, type='str') + ) + ) + + try: + zk_host = module.params.pop('zk_host') + zk_port = module.params.pop('zk_port') + path = module.params.pop('path') + value = module.params.pop('value') + + changed = False + with zk_connection(zk_host, zk_port) as zk: + try: + zk.get(path) + except kazoo.exceptions.NoNodeError: + if value is None: + zk.create(path, makepath=True) + else: + zk.create(path, value=value.encode(), makepath=True) + changed = True + + module.exit_json(changed=changed) + except Exception as e: + module.exit_json(failed=True, changed=True, msg=e) + + +# import module snippets +from ansible.module_utils.basic import * # noqa +if __name__ == '__main__': + main() diff --git a/kolla/common/config.py b/kolla/common/config.py index b5e2fb598..f5b9dc596 100644 --- a/kolla/common/config.py +++ b/kolla/common/config.py @@ -26,7 +26,7 @@ INSTALL_TYPE_CHOICES = ['binary', 'source', 'rdo', 'rhos'] _PROFILE_OPTS = [ cfg.ListOpt('infra', default=['ceph', 'data', 'mariadb', 'haproxy', - 'keepalived', 'kolla-ansible', 'memcached', + 'keepalived', 'kolla-toolbox', 'memcached', 'mongodb', 'openvswitch', 'rabbitmq', 'rsyslog'], help='Infra images'), cfg.ListOpt('main', @@ -39,14 +39,14 @@ _PROFILE_OPTS = [ 'magnum', 'mistral', 'trove,' 'zaqar', 'zookeeper'], help='Aux Images'), cfg.ListOpt('default', - default=['data', 'kolla-ansible', 'glance', 'haproxy', + default=['data', 'kolla-toolbox', 'glance', 'haproxy', 'heat', 'horizon', 'keepalived', 'keystone', 'memcached', 'mariadb', 'neutron', 'nova', 'openvswitch', 'rabbitmq', 'rsyslog'], help='Default images'), cfg.ListOpt('gate', default=['ceph', 'cinder', 'glance', 'haproxy', 'heat', - 'horizon', 'keepalived', 'keystone', 'kolla-ansible', + 'horizon', 'keepalived', 'keystone', 'kolla-toolbox', 'mariadb', 'memcached', 'neutron', 'nova', 'openvswitch', 'rabbitmq', 'rsyslog'], help='Gate images'), diff --git a/tools/cleanup-containers b/tools/cleanup-containers index 97d0f42a1..7db71eb3a 100755 --- a/tools/cleanup-containers +++ b/tools/cleanup-containers @@ -18,7 +18,7 @@ else ironic-{discoverd,conductor,api,pxe} \ keepalived \ keystone \ - kolla_ansible \ + kolla_toolbox \ magnum_{api,conductor} \ manila_{api,share,scheduler} \ mariadb \ -- cgit v1.2.3