GithubHelp home page GithubHelp logo

kkirsche / ansible-generator Goto Github PK

View Code? Open in Web Editor NEW
66.0 66.0 8.0 219 KB

Generate ansible directory structures quickly and easily

Home Page: https://pypi.python.org/pypi/ansible-generator

License: BSD 4-Clause "Original" or "Old" License

Python 100.00%
ansible automation generator

ansible-generator's People

Contributors

kkirsche 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  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  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ansible-generator's Issues

--roles option doesn't call ansible-galaxy unless --projects flag is used

Hello,

Cool project!

With the following setup, I'm unable to get the --roles option to run ansible-galaxy and create the roles, unless --projects is also used in conjunction with it. The verbose output does not show any errors, and it does indeed create the roles folder, it just doesn't populate it. Based on the examples given in the readme it would appear that invoking ansible-generate in the cwd is acceptable, so I wanted to report this as a bug if this is not the desired behavior.

[tool.poetry.dependencies]
python = "^3.10"
ansible-generator = "^3.0.3"
ansible-core = "^2.13.2"

Failure scenario:

(poetry-3.10)  /Volumes/Seagate/testProjects/python_ansible_generator  ansible-generate -r common ubuntu centos -a -v
msg="initializing generator" inventories="production, staging" alternate_layout="True" projects=""
msg="beginning create directory"
msg="building alternate inventory layout directory paths"
msg="5 required directories" directories="inventories/staging/group_vars, roles, inventories/production/group_vars, inventories/production/host_vars, inventories/staging/host_vars"
creating directory /Volumes/Seagate/testProjects/python_ansible_generator/inventories/production/group_vars
creating directory /Volumes/Seagate/testProjects/python_ansible_generator/inventories/staging/group_vars
creating directory /Volumes/Seagate/testProjects/python_ansible_generator/inventories/production/host_vars
creating directory /Volumes/Seagate/testProjects/python_ansible_generator/roles
creating directory /Volumes/Seagate/testProjects/python_ansible_generator/inventories/staging/host_vars
building alternate inventory layout file paths
msg="3 required files" files="{'site.yml', 'inventories/production/hosts', 'inventories/staging/hosts'}"
creating file /Volumes/Seagate/testProjects/python_ansible_generator/inventories/production/hosts
creating file /Volumes/Seagate/testProjects/python_ansible_generator/inventories/staging/hosts
creating file /Volumes/Seagate/testProjects/python_ansible_generator/site.yml

Success scenario:

(poetry-3.10)  /Volumes/Seagate/testProjects/python_ansible_generator  ansible-generate -r common ubuntu centos -a -v -p test_playbook
msg="initializing generator" inventories="production, staging" alternate_layout="True" projects="test_playbook"
msg="beginning create directory"
msg="building alternate inventory layout directory paths"
msg="5 required directories" directories="inventories/staging/host_vars, inventories/production/host_vars, inventories/staging/group_vars, roles, inventories/production/group_vars"
msg="projects was defined" projects="test_playbook"
msg="5 project required directories" directories="test_playbook/roles, test_playbook/inventories/staging/group_vars, test_playbook/inventories/staging/host_vars, test_playbook/inventories/production/host_vars, test_playbook/inventories/production/group_vars"
creating directory /Volumes/Seagate/testProjects/python_ansible_generator/test_playbook/inventories/production/group_vars
creating directory /Volumes/Seagate/testProjects/python_ansible_generator/test_playbook/inventories/staging/group_vars
creating directory /Volumes/Seagate/testProjects/python_ansible_generator/test_playbook/inventories/production/host_vars
creating directory /Volumes/Seagate/testProjects/python_ansible_generator/test_playbook/roles
creating directory /Volumes/Seagate/testProjects/python_ansible_generator/test_playbook/inventories/staging/host_vars
building alternate inventory layout file paths
msg="3 required files" files="{'inventories/staging/hosts', 'inventories/production/hosts', 'site.yml'}"
msg="projects was defined" projects="['test_playbook']"
msg="3 project required files" files="{'test_playbook/inventories/staging/hosts', 'test_playbook/site.yml', 'test_playbook/inventories/production/hosts'}"
creating file /Volumes/Seagate/testProjects/python_ansible_generator/test_playbook/inventories/staging/hosts
creating file /Volumes/Seagate/testProjects/python_ansible_generator/test_playbook/site.yml
creating file /Volumes/Seagate/testProjects/python_ansible_generator/test_playbook/inventories/production/hosts
ansible-galaxy output for role common:
- Role common was created successfully
ansible-galaxy output for role ubuntu:
- Role ubuntu was created successfully
ansible-galaxy output for role centos:

Rework the CLI API to be more intuitive

Right now, everything is hidden behind flags, which is fine but potentially not the most intuitive. It'd be easier I think for people if instead the tool used the positional arguments to capture projects which has a higher chance of being what people expect.

Fix FileNotFoundError

Reported via sentry

FileNotFoundError: [Errno 2] No such file or directory: '/run/user/REDACTED/Ansible/dev/inventories/caca'
  File "ansible_generator/files.py", line 85, in touch
    with open(filename, "a") as f:

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.