diff options
Diffstat (limited to 'playbooks/adhoc')
| -rw-r--r-- | playbooks/adhoc/bootstrap-fedora.yml | 2 | ||||
| -rw-r--r-- | playbooks/adhoc/create_pv/create_pv.yaml | 19 | ||||
| -rw-r--r-- | playbooks/adhoc/docker_loopback_to_lvm/docker_loopback_to_direct_lvm.yml | 2 | ||||
| -rw-r--r-- | playbooks/adhoc/docker_storage_cleanup/docker_storage_cleanup.yml | 2 | ||||
| -rw-r--r-- | playbooks/adhoc/grow_docker_vg/grow_docker_vg.yml | 6 | ||||
| -rw-r--r-- | playbooks/adhoc/noc/create_host.yml | 4 | ||||
| -rw-r--r-- | playbooks/adhoc/noc/create_maintenance.yml | 2 | ||||
| -rw-r--r-- | playbooks/adhoc/noc/get_zabbix_problems.yml | 2 | ||||
| -rw-r--r-- | playbooks/adhoc/s3_registry/s3_registry.j2 | 7 | ||||
| -rw-r--r-- | playbooks/adhoc/s3_registry/s3_registry.yml | 8 | ||||
| -rwxr-xr-x | playbooks/adhoc/sdn_restart/oo-sdn-restart.yml | 53 | ||||
| -rw-r--r-- | playbooks/adhoc/setupnfs.yml | 21 | ||||
| -rw-r--r-- | playbooks/adhoc/uninstall.yml | 72 | ||||
| -rw-r--r-- | playbooks/adhoc/zabbix_setup/clean_zabbix.yml | 2 | ||||
| -rwxr-xr-x | playbooks/adhoc/zabbix_setup/oo-config-zaio.yml | 2 | 
15 files changed, 148 insertions, 56 deletions
diff --git a/playbooks/adhoc/bootstrap-fedora.yml b/playbooks/adhoc/bootstrap-fedora.yml index de9f36c8a..0df77e309 100644 --- a/playbooks/adhoc/bootstrap-fedora.yml +++ b/playbooks/adhoc/bootstrap-fedora.yml @@ -1,4 +1,4 @@ -- hosts: OSv3 +- hosts: OSEv3    gather_facts: false    tasks:      - name: install python and deps for ansible modules diff --git a/playbooks/adhoc/create_pv/create_pv.yaml b/playbooks/adhoc/create_pv/create_pv.yaml index 4f0ef7a75..347d9f574 100644 --- a/playbooks/adhoc/create_pv/create_pv.yaml +++ b/playbooks/adhoc/create_pv/create_pv.yaml @@ -1,20 +1,21 @@  --- -#example run:  +#example run:  # ansible-playbook -e "cli_volume_size=1" \  #                  -e "cli_device_name=/dev/xvdf" \  #                  -e "cli_hosttype=master" \ -#                  -e "cli_environment=ops" \ +#                  -e "cli_clusterid=ops" \  #                  create_pv.yaml -# FIXME: we need to change "environment" to "clusterid" as that's what it really is now.  #  - name: Create a volume and attach it to master    hosts: localhost +  connection: local +  become: no    gather_facts: no    vars:      cli_volume_type: gp2      cli_volume_iops: ''      oo_name: "{{ groups['tag_host-type_' ~ cli_hosttype] | -                 intersect(groups['tag_environment_' ~ cli_environment]) | +                 intersect(groups['oo_clusterid_' ~ cli_clusterid]) |                   first }}"    pre_tasks:    - fail: @@ -24,7 +25,7 @@      - cli_volume_size      - cli_device_name      - cli_hosttype -    - cli_environment +    - cli_clusterid    - name: set oo_name fact      set_fact: @@ -55,7 +56,7 @@      args:        tags:          Name: "pv-{{ hostvars[oo_name]['ec2_tag_Name'] }}" -        env: "{{cli_environment}}" +        clusterid: "{{cli_clusterid}}"      register: voltags    - debug: var=voltags @@ -103,7 +104,7 @@      filesystem:        dev: "{{ cli_device_name }}"        fstype: ext4 -     +    - name: Mount the dev      mount:        name: "{{ pv_mntdir }}" @@ -112,7 +113,7 @@        state: mounted    - name: chgrp g+rwXs -    file:  +    file:        path: "{{ pv_mntdir }}"        mode: 'g+rwXs'        recurse: yes @@ -154,6 +155,6 @@    - debug: var=oc_output -  - fail:  +  - fail:        msg: "Failed to add {{ pv_template }} to master."      when: oc_output.rc != 0 diff --git a/playbooks/adhoc/docker_loopback_to_lvm/docker_loopback_to_direct_lvm.yml b/playbooks/adhoc/docker_loopback_to_lvm/docker_loopback_to_direct_lvm.yml index b6a2d2f26..4d32fc40b 100644 --- a/playbooks/adhoc/docker_loopback_to_lvm/docker_loopback_to_direct_lvm.yml +++ b/playbooks/adhoc/docker_loopback_to_lvm/docker_loopback_to_direct_lvm.yml @@ -113,7 +113,7 @@      args:        tags:          Name: "{{ ec2_tag_Name }}" -        env: "{{ ec2_tag_environment }}" +        clusterid: "{{ ec2_tag_clusterid }}"      register: voltags    - name: Wait for volume to attach diff --git a/playbooks/adhoc/docker_storage_cleanup/docker_storage_cleanup.yml b/playbooks/adhoc/docker_storage_cleanup/docker_storage_cleanup.yml index a19291a9f..b6dde357e 100644 --- a/playbooks/adhoc/docker_storage_cleanup/docker_storage_cleanup.yml +++ b/playbooks/adhoc/docker_storage_cleanup/docker_storage_cleanup.yml @@ -57,7 +57,7 @@    # leaving off the '-t' for docker exec.  With it, it doesn't work with ansible and tty support    - name: update zabbix docker items -    command: docker exec -i oso-rhel7-zagg-client /usr/local/bin/cron-send-docker-metrics.py +    command: docker exec -i oso-rhel7-host-monitoring /usr/local/bin/cron-send-docker-metrics.py    # Get and show docker info again.    - name: Get docker info diff --git a/playbooks/adhoc/grow_docker_vg/grow_docker_vg.yml b/playbooks/adhoc/grow_docker_vg/grow_docker_vg.yml index 63d473146..d24e9cafa 100644 --- a/playbooks/adhoc/grow_docker_vg/grow_docker_vg.yml +++ b/playbooks/adhoc/grow_docker_vg/grow_docker_vg.yml @@ -20,7 +20,7 @@  #   ansible-playbook -e 'cli_tag_name=ops-compute-12345' grow_docker_vg.yml  #  #  Notes: -#  * By default this will do a 55GB GP2 volume.  The can be overidden with the "-e 'cli_volume_size=100'" variable +#  * By default this will do a 200GB GP2 volume.  The can be overidden with the "-e 'cli_volume_size=100'" variable  #  * This does a GP2 by default.  Support for Provisioned IOPS has not been added  #  * This will assign the new volume to /dev/xvdc. This is not variablized, yet.  #  * This can be done with NO downtime on the host @@ -36,7 +36,7 @@    vars:      cli_volume_type: gp2 -    cli_volume_size: 55 +    cli_volume_size: 200  #    cli_volume_iops: "{{ 30 * cli_volume_size }}"    pre_tasks: @@ -151,7 +151,7 @@      args:        tags:          Name: "{{ ec2_tag_Name }}" -        env: "{{ ec2_tag_environment }}" +        clusterid: "{{ ec2_tag_clusterid }}"      register: voltags    - name: check for attached drive diff --git a/playbooks/adhoc/noc/create_host.yml b/playbooks/adhoc/noc/create_host.yml index d250e6e69..2d2cae2b5 100644 --- a/playbooks/adhoc/noc/create_host.yml +++ b/playbooks/adhoc/noc/create_host.yml @@ -1,6 +1,8 @@  ---  - name: 'Create a host object in zabbix'    hosts: localhost +  connection: local +  become: no    gather_facts: no    roles:      - os_zabbix @@ -23,6 +25,8 @@  #ansible-playbook -e 'oo_desc=kwoodson test' -e 'oo_name=kwoodson test name' -e 'oo_start=1435715357' -e 'oo_stop=1435718985' -e 'oo_hostids=11549' create_maintenance.yml  - name: 'Create a host object in zabbix'    hosts: localhost +  connection: local +  become: no    gather_facts: no    roles:      - os_zabbix diff --git a/playbooks/adhoc/noc/create_maintenance.yml b/playbooks/adhoc/noc/create_maintenance.yml index c0ec57ce1..8ad5fa0e2 100644 --- a/playbooks/adhoc/noc/create_maintenance.yml +++ b/playbooks/adhoc/noc/create_maintenance.yml @@ -2,6 +2,8 @@  #ansible-playbook -e 'oo_desc=kwoodson test' -e 'oo_name=kwoodson test name' -e 'oo_start=1435715357' -e 'oo_stop=1435718985' -e 'oo_hostids=11549' create_maintenance.yml  - name: 'Create a maintenace object in zabbix'    hosts: localhost +  connection: local +  become: no    gather_facts: no    roles:      - os_zabbix diff --git a/playbooks/adhoc/noc/get_zabbix_problems.yml b/playbooks/adhoc/noc/get_zabbix_problems.yml index 4b94fa228..79cae24ab 100644 --- a/playbooks/adhoc/noc/get_zabbix_problems.yml +++ b/playbooks/adhoc/noc/get_zabbix_problems.yml @@ -1,6 +1,8 @@  ---  - name: 'Get current hosts who have triggers that are alerting by trigger description'    hosts: localhost +  connection: local +  become: no    gather_facts: no    roles:      - os_zabbix diff --git a/playbooks/adhoc/s3_registry/s3_registry.j2 b/playbooks/adhoc/s3_registry/s3_registry.j2 index acfa89515..10454ad11 100644 --- a/playbooks/adhoc/s3_registry/s3_registry.j2 +++ b/playbooks/adhoc/s3_registry/s3_registry.j2 @@ -9,12 +9,15 @@ storage:    s3:      accesskey: {{ aws_access_key }}      secretkey: {{ aws_secret_key }} -    region: us-east-1 -    bucket: {{ clusterid }}-docker +    region: {{ aws_bucket_region }} +    bucket: {{ aws_bucket_name }}      encrypt: true      secure: true      v4auth: true      rootdirectory: /registry +auth: +  openshift: +    realm: openshift  middleware:    repository:      - name: openshift diff --git a/playbooks/adhoc/s3_registry/s3_registry.yml b/playbooks/adhoc/s3_registry/s3_registry.yml index 4dcef1a42..38ce92e92 100644 --- a/playbooks/adhoc/s3_registry/s3_registry.yml +++ b/playbooks/adhoc/s3_registry/s3_registry.yml @@ -1,18 +1,20 @@  ---  # This playbook creates an S3 bucket named after your cluster and configures the docker-registry service to use the bucket as its backend storage.  # Usage: -#  ansible-playbook s3_registry.yml -e clusterid="mycluster" +#  ansible-playbook s3_registry.yml -e clusterid="mycluster" -e aws_bucket="clusterid-docker" -e aws_region="us-east-1"  #  # The AWS access/secret keys should be the keys of a separate user (not your main user), containing only the necessary S3 access role.  # The 'clusterid' is the short name of your cluster. -- hosts: tag_env-host-type_{{ clusterid }}-openshift-master +- hosts: tag_clusterid_{{ clusterid }}:&tag_host-type_openshift-master    remote_user: root    gather_facts: False    vars:      aws_access_key: "{{ lookup('env', 'S3_ACCESS_KEY_ID') }}"      aws_secret_key: "{{ lookup('env', 'S3_SECRET_ACCESS_KEY') }}" +    aws_bucket_name: "{{ aws_bucket | default(clusterid ~ '-docker') }}" +    aws_bucket_region: "{{ aws_region | default(lookup('env', 'S3_REGION') | default('us-east-1', true)) }}"    tasks: @@ -29,7 +31,7 @@    - name: Create S3 bucket      local_action: -      module: s3 bucket="{{ clusterid }}-docker" mode=create +      module: s3 bucket="{{ aws_bucket_name }}" mode=create    - name: Set up registry environment variable      command: oc env dc/docker-registry REGISTRY_CONFIGURATION_PATH=/etc/registryconfig/config.yml diff --git a/playbooks/adhoc/sdn_restart/oo-sdn-restart.yml b/playbooks/adhoc/sdn_restart/oo-sdn-restart.yml new file mode 100755 index 000000000..0dc021fbc --- /dev/null +++ b/playbooks/adhoc/sdn_restart/oo-sdn-restart.yml @@ -0,0 +1,53 @@ +#!/usr/bin/ansible-playbook +--- +#example run: +# ansible-playbook -e "host=ops-node-compute-abcde" oo-sdn-restart.yml +# + +- name: Check vars +  hosts: localhost +  gather_facts: false +  +  pre_tasks: +  - fail: +      msg: "Playbook requires host to be set" +    when: host is not defined or host == '' + +- name: Restart openshift/docker (and monitoring containers) +  hosts: oo_version_3:&oo_name_{{ host }} +  gather_facts: false +  user: root + +  tasks: +  - name: stop openshift/docker +    service: +      name: "{{ item }}" +      state: stopped +    with_items: +    - atomic-openshift-node +    - docker + +  - name: restart openvswitch +    service: +      name: openvswitch +      state: restarted + +  - name: wait 5 sec +    pause: +      seconds: 5 + +  - name: start openshift/docker +    service: +      name: "{{ item }}" +      state: started +    with_items: +    - atomic-openshift-node +    - docker + +  - name: start monitoring containers +    service: +      name: "{{ item }}" +      state: restarted +    with_items: +    - oso-f22-host-monitoring +    - oso-rhel7-zagg-client diff --git a/playbooks/adhoc/setupnfs.yml b/playbooks/adhoc/setupnfs.yml new file mode 100644 index 000000000..5f3631fcf --- /dev/null +++ b/playbooks/adhoc/setupnfs.yml @@ -0,0 +1,21 @@ +--- +### This playbook is old and we are currently not using NFS. +- hosts: tag_Name_nfs-v3-stg +  sudo: no +  remote_user: root +  gather_facts: no +  roles: +  - role: openshift_storage_nfs_lvm +    mount_dir: /exports/stg-black +    volume_prefix: "kwoodsontest" +    volume_size: 5 +    volume_num_start: 222 +    number_of_volumes: 3 +  tasks: +  - fetch: +    dest: json/ +    src: /root/"{{ item }}" +  with_items: +  - persistent-volume.kwoodsontest5g0222.json +  - persistent-volume.kwoodsontest5g0223.json +  - persistent-volume.kwoodsontest5g0224.json diff --git a/playbooks/adhoc/uninstall.yml b/playbooks/adhoc/uninstall.yml index 08a2ea6fb..36d686c8b 100644 --- a/playbooks/adhoc/uninstall.yml +++ b/playbooks/adhoc/uninstall.yml @@ -19,15 +19,19 @@        failed_when: false        register: ostree_output +      # Since we're not calling openshift_facts we'll do this for now      - set_fact:          is_atomic: "{{ ostree_output.rc == 0 }}" +    - set_fact: +        is_containerized: "{{ is_atomic or containerized | default(false) | bool }}"      - name: Remove br0 interface        shell: ovs-vsctl del-br br0        changed_when: False        failed_when: False -    - service: name={{ item }} state=stopped +    - name: Stop services +      service: name={{ item }} state=stopped        with_items:          - atomic-enterprise-master          - atomic-enterprise-node @@ -36,6 +40,7 @@          - atomic-openshift-master-controllers          - atomic-openshift-node          - etcd +        - haproxy          - openshift-master          - openshift-master-api          - openshift-master-controllers @@ -46,41 +51,11 @@          - origin-master-controllers          - origin-node          - pcsd +      failed_when: false -    - yum: name={{ item }} state=absent -      when: ansible_pkg_mgr == "yum" and not is_atomic | bool -      with_items: -        - atomic-enterprise -        - atomic-enterprise-master -        - atomic-enterprise-node -        - atomic-enterprise-sdn-ovs -        - atomic-openshift -        - atomic-openshift-clients -        - atomic-openshift-master -        - atomic-openshift-node -        - atomic-openshift-sdn-ovs -        - corosync -        - etcd -        - openshift -        - openshift-master -        - openshift-node -        - openshift-sdn -        - openshift-sdn-ovs -        - openvswitch -        - origin -        - origin-clients -        - origin-master -        - origin-node -        - origin-sdn-ovs -        - pacemaker -        - pcs -        - tuned-profiles-atomic-enterprise-node -        - tuned-profiles-atomic-openshift-node -        - tuned-profiles-openshift-node -        - tuned-profiles-origin-node - -    - dnf: name={{ item }} state=absent -      when: ansible_pkg_mgr == "dnf" and not is_atomic | bool +    - name: Remove packages +      action: "{{ ansible_pkg_mgr }} name={{ item }} state=absent" +      when: not is_atomic | bool        with_items:          - atomic-enterprise          - atomic-enterprise-master @@ -93,6 +68,7 @@          - atomic-openshift-sdn-ovs          - corosync          - etcd +        - haproxy          - openshift          - openshift-master          - openshift-node @@ -164,14 +140,26 @@        with_items:          - registry\.access\..*redhat\.com/openshift3          - registry\.access\..*redhat\.com/aep3 +        - registry\.access\..*redhat\.com/rhel7/etcd          - docker.io/openshift      - shell:  "docker rmi -f {{ item.stdout_lines | join(' ') }}"        changed_when: False        failed_when: False        with_items: "{{ images_to_delete.results }}" +     +    - name: Remove sdn drop files +      file:  +        path: /run/openshift-sdn +        state: absent +         +    - name: restart docker +      service: +        name: docker +        state: restarted -    - file: path={{ item }} state=absent +    - name: Remove remaining files +      file: path={{ item }} state=absent        with_items:          - "~{{ ansible_ssh_user }}/.kube"          - /etc/ansible/facts.d/openshift.fact @@ -181,7 +169,15 @@          - /etc/openshift          - /etc/openshift-sdn          - /etc/origin +        - /etc/systemd/system/atomic-openshift-master.service +        - /etc/systemd/system/atomic-openshift-master-api.service +        - /etc/systemd/system/atomic-openshift-master-controllers.service +        - /etc/systemd/system/atomic-openshift-node.service +        - /etc/systemd/system/etcd_container.service +        - /etc/systemd/system/openvswitch.service          - /etc/sysconfig/atomic-enterprise-master +        - /etc/sysconfig/atomic-enterprise-master-api +        - /etc/sysconfig/atomic-enterprise-master-controllers          - /etc/sysconfig/atomic-enterprise-node          - /etc/sysconfig/atomic-openshift-master          - /etc/sysconfig/atomic-openshift-master-api @@ -206,6 +202,10 @@          - /usr/lib/systemd/system/atomic-openshift-master-controllers.service          - /usr/lib/systemd/system/origin-master-api.service          - /usr/lib/systemd/system/origin-master-controllers.service +        - /usr/local/bin/openshift +        - /usr/local/bin/oadm +        - /usr/local/bin/oc +        - /usr/local/bin/kubectl      # Since we are potentially removing the systemd unit files for separated      # master-api and master-controllers services, so we need to reload the diff --git a/playbooks/adhoc/zabbix_setup/clean_zabbix.yml b/playbooks/adhoc/zabbix_setup/clean_zabbix.yml index 1e884240a..09f7c76cc 100644 --- a/playbooks/adhoc/zabbix_setup/clean_zabbix.yml +++ b/playbooks/adhoc/zabbix_setup/clean_zabbix.yml @@ -1,6 +1,8 @@  ---  - hosts: localhost    gather_facts: no +  connection: local +  become: no    vars:      g_server: http://localhost:8080/zabbix/api_jsonrpc.php      g_user: '' diff --git a/playbooks/adhoc/zabbix_setup/oo-config-zaio.yml b/playbooks/adhoc/zabbix_setup/oo-config-zaio.yml index e2b8150c6..ec28564cf 100755 --- a/playbooks/adhoc/zabbix_setup/oo-config-zaio.yml +++ b/playbooks/adhoc/zabbix_setup/oo-config-zaio.yml @@ -2,6 +2,8 @@  ---  - hosts: localhost    gather_facts: no +  connection: local +  become: no    vars:      g_server: http://localhost/zabbix/api_jsonrpc.php      g_user: Admin  | 
