Skip to content

Instantly share code, notes, and snippets.

@wahello
Forked from jfrancoa/swift-disable.yaml
Created February 22, 2021 03:25
Show Gist options
  • Select an option

  • Save wahello/c8c59f6523fe974dced068aea02d390c to your computer and use it in GitHub Desktop.

Select an option

Save wahello/c8c59f6523fe974dced068aea02d390c to your computer and use it in GitHub Desktop.

Revisions

  1. Jose Luis Franco created this gist Sep 8, 2017.
    34 changes: 34 additions & 0 deletions swift-disable.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    ---
    - hosts: 127.0.0.1
    connection: local
    gather_facts: no

    tasks:
    - name: Check if swift-storage services are deployed
    command: systemctl is-enabled --quiet "{{ item }}"
    register: swift_services_enabled
    ignore_errors: true
    with_items:
    - openstack-swift-account-auditor
    - openstack-swift-account-reaper
    - openstack-swift-account-replicator
    - openstack-swift-account
    - openstack-swift-container-auditor
    - openstack-swift-container-replicator
    - openstack-swift-container-updater
    - openstack-swift-container
    - openstack-swift-object-auditor
    - openstack-swift-object-expirer
    - openstack-swift-object-replicator
    - openstack-swift-object-updater
    - openstack-swift-object
    - debug:
    var: swift_services_enabled
    - name: Check that services are running
    command: systemctl is-active --quiet "{{ item.item }}"
    with_items: "{{ swift_services_enabled.results }}"
    when: item.rc == 0
    - name: Stop and disable swift storage services
    service: name={{ item.item }} state=stopped enabled=no
    with_items: "{{ swift_services_enabled.results }}"
    when: item.rc == 0