Loading content/ansible-example-role.rst +1 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ A final word on boiler-plate In a previous post I mentioned that I have several repositories that have the same boiler-plate and how I plan on dealing with that. Now, this is the first attempt at this. The idea is having a base repo that I clone, add another remote and voilà, a new project with the scaffloding already there. For bonus points, I and voilà, a new project with the scaffolding already there. For bonus points, I can update the base repo and pull those changes in all projects. Here's how I do it: Loading content/ansible-modules.rst +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ modules written in Python, which is nice considering the lack of boiler-plate that Ansible provides and that Python is my personal preference. The whole story is really quite simple, create a separate git repository with the modules in it. You can put them in subdirectories and as a far as I know, the modules in it. You can put them in sub-directories and as a far as I know, there's no restriction on the hierarchy depth. In your playbook directory create a :code:`library` directory (the Ansible default, so you can change this in :code:`ansible.cfg`) and create an empty :code:`__init__.py` file inside that Loading content/ansible-python.rst +2 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ Using Ansible as a Python module :summary: Using Ansible as a Python module when playbooks are not enough. At my current employer we have several servers in production with various providers, some of them with multiple ip addresses. When configuring the providers, some of them with multiple IP addresses. When configuring the firewall to allow traffic from other servers I reached for Ansible. The obvious solution was to use a nested loop, something like this: Loading @@ -22,7 +22,7 @@ obvious solution was to use a nested loop, something like this: However, this syntax is invalid (and other variations I tried). Using :code:`include` with :code:`with_items` is deprecated and I didn't manage to get it to work with registering variables as well. What I had left was programaticaly generating a playbook, but investigating further I found that programmatically generating a playbook, but investigating further I found that Ansible can be imported as a Python module. Incorporating Ansible in Python Loading content/aws_change_own_password.rst +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ Self service AWS IAM policy A common practice for me when a new member joins the team or when someone forgets his/ her AWS account password is to change the account password myself, send the new password over an unsecure channel (email, Slack) but force the send the new password over an insecure channel (email, Slack) but force the account to change the password on first login. Also, I prefer to have users manage their own keys to AWS themselves. But without the correct IAM policy users aren't able to perform either action. Here's an IAM to allow both: Loading content/git_serve.rst +2 −2 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ your git repository is quite large and your internet connection is slow or your build process would benefit from pulling from an intermediary without authentication). Here are 2 ways to serve your git repository without any configuration or software installation. Both ways serve a single repository without authentication or encryption but readonly (no push). without authentication or encryption but read-only (no push). Using the git protocol ---------------------- Loading @@ -28,7 +28,7 @@ And on the client you can clone by running git clone git://servername/ reponame Using the http protocol Using the HTTP protocol ----------------------- This way serves the repo over HTTP using Python 2's SimpleHTTPServer. Run the Loading Loading
content/ansible-example-role.rst +1 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ A final word on boiler-plate In a previous post I mentioned that I have several repositories that have the same boiler-plate and how I plan on dealing with that. Now, this is the first attempt at this. The idea is having a base repo that I clone, add another remote and voilà, a new project with the scaffloding already there. For bonus points, I and voilà, a new project with the scaffolding already there. For bonus points, I can update the base repo and pull those changes in all projects. Here's how I do it: Loading
content/ansible-modules.rst +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ modules written in Python, which is nice considering the lack of boiler-plate that Ansible provides and that Python is my personal preference. The whole story is really quite simple, create a separate git repository with the modules in it. You can put them in subdirectories and as a far as I know, the modules in it. You can put them in sub-directories and as a far as I know, there's no restriction on the hierarchy depth. In your playbook directory create a :code:`library` directory (the Ansible default, so you can change this in :code:`ansible.cfg`) and create an empty :code:`__init__.py` file inside that Loading
content/ansible-python.rst +2 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ Using Ansible as a Python module :summary: Using Ansible as a Python module when playbooks are not enough. At my current employer we have several servers in production with various providers, some of them with multiple ip addresses. When configuring the providers, some of them with multiple IP addresses. When configuring the firewall to allow traffic from other servers I reached for Ansible. The obvious solution was to use a nested loop, something like this: Loading @@ -22,7 +22,7 @@ obvious solution was to use a nested loop, something like this: However, this syntax is invalid (and other variations I tried). Using :code:`include` with :code:`with_items` is deprecated and I didn't manage to get it to work with registering variables as well. What I had left was programaticaly generating a playbook, but investigating further I found that programmatically generating a playbook, but investigating further I found that Ansible can be imported as a Python module. Incorporating Ansible in Python Loading
content/aws_change_own_password.rst +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ Self service AWS IAM policy A common practice for me when a new member joins the team or when someone forgets his/ her AWS account password is to change the account password myself, send the new password over an unsecure channel (email, Slack) but force the send the new password over an insecure channel (email, Slack) but force the account to change the password on first login. Also, I prefer to have users manage their own keys to AWS themselves. But without the correct IAM policy users aren't able to perform either action. Here's an IAM to allow both: Loading
content/git_serve.rst +2 −2 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ your git repository is quite large and your internet connection is slow or your build process would benefit from pulling from an intermediary without authentication). Here are 2 ways to serve your git repository without any configuration or software installation. Both ways serve a single repository without authentication or encryption but readonly (no push). without authentication or encryption but read-only (no push). Using the git protocol ---------------------- Loading @@ -28,7 +28,7 @@ And on the client you can clone by running git clone git://servername/ reponame Using the http protocol Using the HTTP protocol ----------------------- This way serves the repo over HTTP using Python 2's SimpleHTTPServer. Run the Loading