New answers tagged

0

Been there done that... Try prompt ']' and upgrade ansible to the version 2.8.1 "stdout_lines": [ [ "Running command on switch 1", "Cleaning up unnecessary package files", "No path specified, will use booted path flash:packages.conf", "Cleaning flash:", " Scanning boot directory ...


-1

Ansible provides a module for telnet provisioning. See: https://docs.ansible.com/ansible/latest/modules/telnet_module.html


0

Your statements look ok. If I create a test case from the sparse info you provided and what I can observe when gathering facts from my own hosts, I can detect old/recent distributions correctly using your conditions. See my example below. I suggest you double check the data gathered from your host to understand why it doesn't match. The easiest way for that:...


1

with_fileglog creates a loop with the fileglob lookup. As all other lookups it runs on the controller machine, not on the remote server. Since I guess you don't already have those backup files on the controller in the path you referenced, your loop is empty. As you have guessed, this approach will not work for your scenario. I suggest you have a look at ...


0

Did you try DbUp? DbUp homepage This utility can apply patches to database and maintain its version. It writes execution log to databases and is able to run scripts that were not applied. I'm using that project over 3 years now and it does it job well.


1

If the OS has a python installation, you can use Ansible to manage it.. Note that you should check the individual module requirements (for example the snap module) since they may have dependencies which cannot be satisfied by your OS. In general though the modules are written in python and as such a python runtime is needed.


0

Short Answer: You do programming here. Consider Programming Standards (cleancode) like "package by feature" and build role which are reusable and express the reason of the role. e.g. roles: - role: jdk - role: tomcat (contains tasks with 'install tomcat', 'configure tomcat' ) (requires jdk) - role: the_wepapp (requires tomcat) ...


0

I came up with what I think is a pretty good solution. First, it requires the addition of this to each role: - assert: that: "{{ item.key }} is defined" fail_msg: "Attempted to override an unknown variable: {{ item.key }}" quiet: yes loop: "{{ q('dict', override) }}" - set_fact: { "{{ item.key }}":"{{ item.value }}" } loop: "{{ q('dict', ...


1

Q: " Prevent misspelled variables passed to Ansible roles ... remove the defaults/main.yml, ... But then I can't take advantage of the benefits of having defaults. Are there other solutions? A: Yes. Tell include_role to read other file defaults_from. Fit the content of this file to your needs. For example - include_role: name: foo defaults_from: ...


0

Sounds like you want the combine filter. You could read each file into a specific variable, then use the combine filter to create all-pets. At that point, it would be in memory of course, so you might want to use the answer to this question to write it to a file: - name: Read vars include_vars: file: "pets/{{ item }}_pets.yml" var: "{{ item }}" ...


2

Thanks for linking your question. Here's the github thread for reference: https://github.com/geerlingguy/ansible-role-certbot/issues/87 There are many different ways to get certs from a CA. certbot (what this repo uses) is just one of the ways which uses letsencrypt as a certificate authority. acme_certificate is more generic and if you can't use ...


2

https://docs.ansible.com/ansible/latest/modules/reboot_module.html - name: Unconditionally reboot the machine with all defaults reboot: - name: Reboot a slow machine that might have lots of updates to apply reboot: reboot_timeout: 3600


1

You can use Ansible’s template module transfers templated files to remote hosts. It works similarly to the copy module, but with major difference: You can use the jinja2 templating language in your files, which will be templated out separately for each remote host and you can have conditional statements, loops, filters for transforming the data, do ...


1

Copy module should work - hosts: all tasks: - copy: src: /data/new_config dest: /opt/zservice/etc/config owner: root group: wheel mode: '0750' backup: yes If you worry about the number of the hosts take a look at serial.


0

At the controller, for practical reasons, it's good to create a special user who will be running commands ansible-* as ansible_user. Typically ansible_user connects via ssh to remote hosts and authenticates with the public key. It's practical to have different ssh keys for admin and ansible_user. ansible_user public key will be authorized by all remote ...


0

As explained by @TheFiddlerWins, there is no need to add ldap groups into /etc/group. The challenge here is to give ssh a way to access your ldap directory: I did this some time ago by adding a custom script to the sshd config, but using pam looks a lot cleaner today. Then you just need to handle the required changes using your playbook. Just remember ...


1

I'd say to do it as you last explained it: using the admin user created by tf with ansible, and then create any other user using ansible. The downside is from the security pov, does ansible needs an admin user ? If yes then keep the tf created user, if not then i'd suggest creating a new non-admin user for ansible. As ansible is a ssh based config mgmt ...


Top 50 recent answers are included