Last active
July 12, 2017 15:51
-
-
Save thisdougb/6ec15236f4e76eb767c7cbbf44706916 to your computer and use it in GitHub Desktop.
my test
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
[root@ansible-tower ansible-tower-setup-3.1.4]# more restore.yml | |
--- | |
- hosts: database | |
gather_facts: false | |
tasks: | |
- name: Temporarily grant createdb role | |
postgresql_user: | |
name: awx | |
role_attr_flags: CREATEDB | |
become: yes | |
become_user: postgres | |
- hosts: tower:!tower[0] | |
gather_facts: false | |
tasks: | |
- name: Stop Tower services on all nodes | |
command: ansible-tower-service stop | |
- hosts: tower[0] | |
gather_facts: yes | |
roles: | |
- role: check_config_static | |
- role: config_dynamic | |
- role: restore | |
restore_database: "{{ config_dynamic_database }}" | |
restore_pg_database: "{{ pg_database }}" | |
- hosts: tower:!tower[0] | |
gather_facts: false | |
tasks: | |
- name: Start Tower services on all nodes | |
command: ansible-tower-service start | |
- hosts: database | |
gather_facts: false | |
tasks: | |
- name: Revoke createdb role | |
postgresql_user: | |
name: awx | |
role_attr_flags: NOCREATEDB | |
become: yes | |
become_user: postgres | |
[root@ansible-tower restore]# head -20 tower.db | |
-- | |
-- PostgreSQL database dump | |
-- | |
SET statement_timeout = 0; | |
SET lock_timeout = 0; | |
SET client_encoding = 'UTF8'; | |
SET standard_conforming_strings = on; | |
SET check_function_bodies = false; | |
SET client_min_messages = warning; | |
DROP DATABASE awx; | |
-- | |
-- Name: awx; Type: DATABASE; Schema: -; Owner: awx | |
-- | |
CREATE DATABASE awx WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8'; | |
ALTER DATABASE awx OWNER TO awx; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment