Git Product home page Git Product logo

ansible-playbook-examples's People

Contributors

andreepyro avatar dependabot[bot] avatar dszakallas avatar james-laing avatar keshavattrey avatar lukaszahradnik avatar mahendra-maplelabs avatar raekins avatar rlondner avatar sdodsley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-playbook-examples's Issues

py-pure-client and/or requests are not installed. error in purefa_info.py

Hello,
I am getting an error in ansible
.ansible/collections/ansible_collections/purestorage/flasharray/plugins/module_utils/purefa.py module when the following ansible-playbook is run

  • hosts: localhost
    gather_facts: true
    collections:
    • purestorage.flasharray
      vars:
      src_fa_url: <renamed-pure_name>
      src_api_token:
      tasks:
    • name: Get source FlashArray info
      purefa_info:
      gather_subset:
      • minimum
      • network
      • interfaces
        fa_url: "{{ src_fa_url }}"
        api_token: "{{ src_api_token }}"
        register: src_array_info

The code is breaking in “def get_system(module):” function in purefa.py
The following code runs fine with PurityOS 5.3.12 but gives an error in 6.2.6 Is there any quick fix for this?

Flasharray collection is
VERSION = 1.4
USER_AGENT_BASE = “Ansible”

Error message with -vvv option

The full traceback is:
WARNING: The below traceback may not be related to the actual failure.
File "/tmp/ansible_purefa_info_payload_JB8L3X/ansible_purefa_info_payload.zip/ansible_collections/purestorage/flasharray/plugins/modules/purefa_info.py", line 442, in
fatal: [localhost]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"api_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"fa_url": "",
"gather_subset": [
"minimum",
"network",
"interfaces"
]
}
},
"msg": "py-pure-client and/or requests are not installed."
}

The error was: NameError: name 'flashblade' is not defined

When running ansible to set user policy:

- name: Set user policy
  purefb_userpolicy:
    name: "{{ fb_user_name }}"
    account: "{{ fb_account_name }}"
    policy:
      - pure:policy/bucket-info
      - pure:policy/bucket-list
      - pure:policy/object-delete
      - pure:policy/object-list
      - pure:policy/object-read
      - pure:policy/object-write
    fb_url: "{{ fb_url }}"
    api_token: "{{ api_token }}"
    state: present

This error comes up: "The error was: NameError: name 'flashblade' is not defined"

Full log here:

TASK [Set user policy] *********************************************************************************************************************************************************************************************************************************************************
task path: /Users/user/Desktop/Git/StorageAdmin/ansible/createAccountAndBucket.yml:31
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: user
<127.0.0.1> EXEC /bin/sh -c 'echo ~user && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /Users/user/.ansible/tmp"&& mkdir "echo /Users/user/.ansible/tmp/ansible-tmp-1663231784.374453-88058-237659549406600" && echo ansible-tmp-1663231784.374453-88058-237659549406600="echo /Users/user/.ansible/tmp/ansible-tmp-1663231784.374453-88058-237659549406600" ) && sleep 0'
Using module file /Users/user/.ansible/collections/ansible_collections/purestorage/flashblade/plugins/modules/purefb_userpolicy.py
<127.0.0.1> PUT /Users/user/.ansible/tmp/ansible-local-88055jx3o0_5b/tmp5nvobtuc TO /Users/user/.ansible/tmp/ansible-tmp-1663231784.374453-88058-237659549406600/AnsiballZ_purefb_userpolicy.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /Users/user/.ansible/tmp/ansible-tmp-1663231784.374453-88058-237659549406600/ /Users/user/.ansible/tmp/ansible-tmp-1663231784.374453-88058-237659549406600/AnsiballZ_purefb_userpolicy.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3 /Users/user/.ansible/tmp/ansible-tmp-1663231784.374453-88058-237659549406600/AnsiballZ_purefb_userpolicy.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/user/.ansible/tmp/ansible-tmp-1663231784.374453-88058-237659549406600/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
File "/Users/user/.ansible/tmp/ansible-tmp-1663231784.374453-88058-237659549406600/AnsiballZ_purefb_userpolicy.py", line 107, in
_ansiballz_main()
File "/Users/user/.ansible/tmp/ansible-tmp-1663231784.374453-88058-237659549406600/AnsiballZ_purefb_userpolicy.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/Users/user/.ansible/tmp/ansible-tmp-1663231784.374453-88058-237659549406600/AnsiballZ_purefb_userpolicy.py", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.purestorage.flashblade.plugins.modules.purefb_userpolicy', init_globals=dict(_module_fqn='ansible_collections.purestorage.flashblade.plugins.modules.purefb_userpolicy', _modlib_path=modlib_path),
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py", line 210, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/var/folders/dg/3wffd1js285br3vdnr0jz7vr0000gp/T/ansible_purefb_userpolicy_payload_fm1daj9x/ansible_purefb_userpolicy_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_userpolicy.py", line 269, in
File "/var/folders/dg/3wffd1js285br3vdnr0jz7vr0000gp/T/ansible_purefb_userpolicy_payload_fm1daj9x/ansible_purefb_userpolicy_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_userpolicy.py", line 237, in main
File "/var/folders/dg/3wffd1js285br3vdnr0jz7vr0000gp/T/ansible_purefb_userpolicy_payload_fm1daj9x/ansible_purefb_userpolicy_payload.zip/ansible_collections/purestorage/flashblade/plugins/module_utils/purefb.py", line 114, in get_system
NameError: name 'flashblade' is not defined
fatal: [localhost]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File "/Users/user/.ansible/tmp/ansible-tmp-1663231784.374453-88058-237659549406600/AnsiballZ_purefb_userpolicy.py", line 107, in \n _ansiballz_main()\n File "/Users/user/.ansible/tmp/ansible-tmp-1663231784.374453-88058-237659549406600/AnsiballZ_purefb_userpolicy.py", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/Users/user/.ansible/tmp/ansible-tmp-1663231784.374453-88058-237659549406600/AnsiballZ_purefb_userpolicy.py", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.purestorage.flashblade.plugins.modules.purefb_userpolicy', init_globals=dict(_module_fqn='ansible_collections.purestorage.flashblade.plugins.modules.purefb_userpolicy', _modlib_path=modlib_path),\n File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py", line 210, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code\n exec(code, run_globals)\n File "/var/folders/dg/3wffd1js285br3vdnr0jz7vr0000gp/T/ansible_purefb_userpolicy_payload_fm1daj9x/ansible_purefb_userpolicy_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_userpolicy.py", line 269, in \n File "/var/folders/dg/3wffd1js285br3vdnr0jz7vr0000gp/T/ansible_purefb_userpolicy_payload_fm1daj9x/ansible_purefb_userpolicy_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_userpolicy.py", line 237, in main\n File "/var/folders/dg/3wffd1js285br3vdnr0jz7vr0000gp/T/ansible_purefb_userpolicy_payload_fm1daj9x/ansible_purefb_userpolicy_payload.zip/ansible_collections/purestorage/flashblade/plugins/module_utils/purefb.py", line 114, in get_system\nNameError: name 'flashblade' is not defined\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}

Make Ansible Modules Idempotent

Every time I run the purefa_host module it says "Changed" even though no changes were made. Can you please make this idempotent? I would like to be able to run 1x Playbook and have it configure my entire array. And only items that are actually changed should be marked as changed.

The directory structure does not conform to the standard

https://docs.ansible.com/ansible/2.8/user_guide/playbooks_best_practices.html#directory-layout

production # inventory file for production servers
staging # inventory file for staging environment

group_vars/
group1.yml # here we assign variables to particular groups
group2.yml
host_vars/
hostname1.yml # here we assign variables to particular systems
hostname2.yml

library/ # if any custom modules, put them here (optional)
module_utils/ # if any custom module_utils to support modules, put them here (optional)
filter_plugins/ # if any custom filter plugins, put them here (optional)

site.yml # master playbook
webservers.yml # playbook for webserver tier
dbservers.yml # playbook for dbserver tier

roles/
common/ # this hierarchy represents a "role"
tasks/ #
main.yml # <-- tasks file can include smaller files if warranted
handlers/ #
main.yml # <-- handlers file
templates/ # <-- files for use with the template resource
ntp.conf.j2 # <------- templates end in .j2
files/ #
bar.txt # <-- files for use with the copy resource
foo.sh # <-- script files for use with the script resource
vars/ #
main.yml # <-- variables associated with this role
defaults/ #
main.yml # <-- default lower priority variables for this role
meta/ #
main.yml # <-- role dependencies
library/ # roles can also include custom modules
module_utils/ # roles can also include custom module_utils
lookup_plugins/ # or other types of plugins, like lookup in this case

webtier/              # same kind of structure as "common" was above, done for the webtier role
monitoring/           # ""
fooapp/               # ""

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.