Advertisement
Guest User

Untitled

a guest
Jan 28th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.53 KB | None | 0 0
  1. ---
  2. - name: Get {{ config_type }} configuration
  3.   command: |
  4.    /var/lib/ambari-server/resources/scripts/configs.py
  5.       --user=admin
  6.       --password=admin
  7.       --port={{ AMBARI.ssl.port if AMBARI.ssl.enabled == True else 8080 }}
  8.       --protocol={{ 'https' if AMBARI.ssl.enabled == True else 'http' }}
  9.       --host={{ inventory_hostname }}.{{ domain }}
  10.       --cluster={{ cluster_name }}
  11.       --config-type={{ config_type }}
  12.       --action=get
  13.       --file /tmp/{{ config_type }}.json
  14.  
  15. - name: Load {{ config_type }}
  16.   slurp:
  17.     path: "/tmp/{{ config_type }}.json"
  18.   register: config_file
  19.  
  20. - name: Register as JSON variables
  21.   set_fact:
  22.     config: "{{ config_file.content|b64decode|from_json }}"
  23.  
  24. - name: Set {{ config_type }} properties
  25.   set_fact:
  26.     config: "{{ config|combine({'properties': { lookup('dict', item).key: lookup('dict', item).value } }, recursive=True) }}"
  27.   with_items: "{{ conf }}"
  28.    
  29. - name: Update {{ config_type }}
  30.   copy:
  31.     content: "{{ config }}"
  32.     dest: /tmp/{{ config_type }}.json
  33.  
  34. - name: Set {{ config_type }} configuration
  35.   command: |
  36.    /var/lib/ambari-server/resources/scripts/configs.py
  37.       --user=admin
  38.       --password=admin
  39.       --port={{ AMBARI.ssl.port if AMBARI.ssl.enabled == True else 8080 }}
  40.       --protocol={{ 'https' if AMBARI.ssl.enabled == True else 'http' }}
  41.       --host={{ inventory_hostname }}.{{ domain }}
  42.       --cluster={{ cluster_name }}
  43.       --config-type={{ config_type }}
  44.       --action=set
  45.       --file /tmp/{{ config_type }}.json
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement