Skip to content

Instantly share code, notes, and snippets.

@lindsm
Created February 1, 2016 21:34
Show Gist options
  • Save lindsm/121b7a538f833d14ce2e to your computer and use it in GitHub Desktop.
Save lindsm/121b7a538f833d14ce2e to your computer and use it in GitHub Desktop.
# Playbook Task
- name: 'Find the sterling hosts'
sterling_agent_ctrl:
env: "{{ target_env }}"
AD_PASSWORD: "{{ AD_PASSWORD }}"
AD_USER: "{{ AD_USER }}"
agent: '{{ agent|default(None) }}'
register: sterling_h
# Module Params
module = AnsibleModule(
argument_spec=dict(
AD_USER=dict(required=True),
AD_PASSWORD=dict(required=True, no_log=True),
env=dict(required=True),
agent=dict(required=True),
),
supports_check_mode=False
)
p = module.params
module.fail_json(msg="our agent value is: ".format(p['agent']))
main()
## CLI and Result
ansible-playbook playbooks/apps/commerce_sterling_agent_control.yml -i inventory/hosts -e "target_env=ecn30 action_type_sterling=status-all agent=GCFillAsyncPublishAgentServer-0" --ask-vault-pass
TASK: [Find the sterling hosts] ***********************************************
failed: [tower] => {"failed": true}
msg: our agent value is:
FATAL: all hosts have already failed -- aborting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment