====== Ansible ====== * http://docs.ansible.com * [[https://lightcode.fr/article/ansible-conseils-organisation/|Ansible : conseils d'organisation]] Installer ''ansible'' sudo apt-add-repository ppa:ansible/ansible sudo apt install ansible Les NOUVEAUX paquets suivants seront installés : ansible ansible-core python-babel-localedata python3-babel python3-jinja2 python3-jmespath python3-kerberos python3-ntlm-auth python3-requests-kerberos python3-requests-ntlm python3-resolvelib python3-winrm python3-xmltodict sshpass Définir le user ssh, changer le port : $ ansible -e "ansible_user=debian" -e "ansible_port=30001" -m ping ===== OpenStack ===== * dynamic inventory via openstack [[http://docs.ansible.com/ansible/latest/intro_dynamic_inventory.html#example-openstack-external-inventory-script|http://docs.ansible.com/ansible/latest/intro_dynamic_inventory.html#example-openstack-external-inventory-script]] * [[https://community.runabove.com/kb/en/instances/use-openstack-command-line-tools.html|https://community.runabove.com/kb/en/instances/use-openstack-command-line-tools.html]] Voir aussi: [[:informatique:cloud_computing#openstack|]] Install Openstack python client sudo apt-get install python-os-client-config python-shade Get the ''Openstack.rc'' file {{:informatique:openstack-rc_in_horizon_at_ovh.png?nolink&520}} Then source it (api password will be asked), and give a try $ wget https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/openstack.py $ chmod +x openstack.py $ source xxxxxxxxxxx-openrc.sh $ ./openstack.py --list ===== Docker ===== Pratique d'utiliser Docker pour tester des playbooks. Attention, on ne peut pas tout faire car il manque la gestion des services, mais pour des manipulations de fichiers ça le fait. Il y a des images avec systemd mais quid des nouveaux ports à exposer ? Je n'ai pas //encore// trouvé de solution toute simple :-(. Une image docker à partir de Debian pour faire tourner un serveur OpenSSH * https://gitlab.com/Artefacts/docker-openssh-hosts/-/tree/main Aperçu de l'idée de la Dockerfile: # # Run an OpenSSH server # # Build: # docker build -t "cyrille37/openssh-server" -f openssh.dockerfile . # Run: # docker run -p 22:22 --name "sshd" --rm cyrille37/openssh-server # Stop: # docker stop sshd # FROM debian:12-slim LABEL MAINTAINER Cyrille37 RUN apt -y update && apt -y install openssh-server sudo locales \ && rm -rf /var/lib/apt/lists/* # set locale to fr_FR to allow french accented characters RUN localedef -i fr_FR -c -f UTF-8 -A /usr/share/locale/locale.alias fr_FR.UTF-8 ENV LANG fr_FR.utf8 # create user "milou" with password "secret" and permits `sudo` without password RUN useradd -m -s /bin/bash -G sudo -u 1000 milou RUN usermod -aG sudo milou RUN echo 'milou:secret' | chpasswd RUN echo "milou ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers # Mandatory to avoid "Missing privilege separation directory: /run/sshd" RUN service ssh start EXPOSE 22 CMD ["/usr/sbin/sshd","-D"] Pour aller plus loin: * https://www.ansible.com/blog/testing-ansible-roles-with-docker * https://github.com/chrismeyersfsu/provision_docker/ ===== Vagrant ===== * [[/informatique/vagrant|/informatique/vagrant]] * https://symfonycasts.com/screencast/ansible/vagrant-ansible