New answers tagged

1

I understood with the help of the documentation above how to replace environment variables. For example: - hosts: hostnames remote_user: root gather_facts: no vars: ansible_remote_tmp: /tmp tasks: ... Also, it's possible to replace in the separate tasks. Ansible documentation about playbook environment


0

You need to put public ip address or hostname assigned by aws ec2 service, if your aws ec2 instance is public. If your aws ec2 instance is located in vpc, you won't be able to connect it directly. Either you need to setup routing through internet gateway or you have to setup ansible server in vpc.


2

You have all the necessary tools for the 2 use cases you mentioned. For application development, it looks like you have something already set up. I'm assuming, for time's sake, you have automated both code quality and security scanning of your application and that is all working. If you haven't already started packaging your applications into helm to ...


1

If you want to "add base_packages.yml to the title of the task" you'll have to add it to the names of the tasks. For example shell> cat base_packages.yml --- - name: "base_packages: .... " sed might help to automate it.


1

This is indeed a tricky thing to do "right", because there are so many moving parts. I have found that it helps to reduce the degrees of freedom by adopting some conventions, and factoring out some parts. Draw a line between where Terraform is responsible and where Ansible becomes responsible, and separate those stages. You do this so that you can deal with ...


1

You are right about Terraform having a plan-apply cycle which may not be that conducive to automation. The following has worked for me in similar situations: Use Terraform to "develop" new versions of a base EC2 image. Use Ansible playbooks to provision EC2 instances off a specific version of the image and run tests on them.


4

The issue seems resolved, If I escape the backslash in the regex too: - name: Remove LE webroot definition lineinfile: path: "/etc/path/to/config/{{ inventory_hostname }}.conf" regexp: "^{{ inventory_hostname | replace('.', '\\.') }} = /path/to/a/directory" state: absent


0

If you are looking to combine all your CI\CD activities into one single process\pipeline, i would suggest to go with Azure DevOps which also supports Jenkins, Ansible, Kubernetes and almost all the 3rd party\Open source CI\CD tools. So that you could also use your existing tools like Jenkins and Ansible and connect with Azure Devops to make it connected ...


0

If you have Jenkins user public key, on your target hosts authorized keys file, for the user you want to login as, ssh connection authorization should work. This is an example of Jenkinsfile step. ansiblePlaybook colorized: true, installation: 'Ansible', inventory: 'inventory', playbook: 'playbook.yml',tags: "" , skippedTags: "", extras: "--extra-vars ' ...


1

You can add this in inventory: ansible_ssh_common_args="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" It's ignoring check host and setting /dev/null as Known host file.


1

There's a lot that you can do, but I'm not sure with the existing filters you easily augment a dict. Creating a new filter to do it was easier. $ cat filter_plugins/addhomedir.py class FilterModule: @staticmethod def add_home(_val): return [dict(user, home='/home/{0}/'.format(user['name'])) for user in _val if 'sudo' not in ...


Top 50 recent answers are included