Home Some old posts

Some old posts

Here are some old posts

So as I said in my last post I first needed to get some of the old posts. Since I found it not 100% usefull to gather everything I will do a TLDR for the following subjects: proxmox, ansible


How to create a VM in proxmox with ansible.

This one I forgot to backup but a TLDR is the following: I use the proxmox api to clone a cloud init image. This way it is pretty variable and you can alter everything you want. You can checkout the code on my gitlab / github:

https://gitlab.com/jeffrey44113/Easy_Ansible/-/tree/main/ https://github.com/Jeffrey44113/Easy_Ansible


Let ansible connet with a different IP during playbook run

- hosts: all
  become: true
  gather_facts: false

  - name: check if IP is reachable and saves it
      host: ''
      timeout: 20
    register: waitfor
    ignore_unreachable: yes
  - ansible.builtin.set_fact: ansible_ssh_host=""
    when: waitfor is search('Failed to connect to the host via ssh')

So what do I do here and why was it such a headache? Well it is easy but there is one important thing: gather_facts:false This is needed since if you have gather_facts to true it will connect and then it will try to gather the facts. So when it is false then the playbook will continue. After that it checks if anything is reachable and registers it results. After that if the result contains failed to connect it will set the other IP as ansible_ssh_host and the playbook continues. Playbook link: https://gitlab.com/jeffrey44113/Easy_Ansible/-/blob/main/randomPlays/this_or_that_ip.yml

But wait there was allot more?

Well.. Yes indeed but I didn’t found the rest interesting so I didn’t placed them here. I am working on quite allot of new stuff. But time is always a issue. Since I have allot of playbooks I make for my self but not on my public repo and I am switching to gitlab from github I am reviewing everything an placing it bit by bit on my public repos.

I created some playbooks to install zabbix, promtail, haproxy (including compiling the software)

Did you for example know that when you use the password_hash in ansible that you can set the amount of rounds: https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html

It can be quite important with software like directadmin since it can make it quite a bit slower if you use the default amount… Which is a crapload.

For now that is it. I will try to keep a schedule as much as I can but with a new job coming up this Monday and a new kitchen and bathroom coming up will swallow allot of my time.

If you do have any questions for me then of course reach out on twitter and I will get back to you asap!

This post is licensed under CC BY 4.0 by the author.