Last active
June 8, 2023 16:13
-
-
Save jgornick/9962043 to your computer and use it in GitHub Desktop.
Ansible: ./configure, make, make install
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This works | |
- name: Install unixODBC | |
command: sudo {{ item }} chdir="/tmp/{{ mysql_odbc_unixodbc_url | basename | replace('.tar.gz', '') }}" | |
with_items: | |
- ./configure --prefix=/usr/local | |
- make | |
- make install | |
# This _doesn't_ work | |
# Why doesn't the chdir option get recognized? | |
- name: Install unixODBC | |
command: | |
chdir: "/tmp/{{ mysql_odbc_unixodbc_url | basename | replace('.tar.gz', '') }}" | |
free_form: "sudo {{ item }}" | |
with_items: | |
- ./configure --prefix=/usr/local | |
- make | |
- make install |
shell: cd DIR && ./configure --prefix={{ installation_prefix }} && make && make install
if one step fails, it doesn't proceed
How to make configure, make, make install idempotent using ansible??
You can make it idempotent using the "creates" argument.
Check out this task file to see Git built from source using Ansible. It uses creates
as @mariusmuja suggests, but it also makes heavy use of Ansible's facts to store state.
The following worked for me, and stops if the .configure, make, or make install breaks! I also know that I could have just used the command function for all of them, but I was trying to learn how the with_items function works. Hope this helps someone else!
#- name: Installing FFMPEG - name: Running ./configure for FFMPEG command: '"{{ item }}" chdir=/myhome/ffmpeg-2.8.2/' with_items: - ./configure - name: Running "make" for FFMPEG command: '"{{ item }}" chdir=/myhome/ffmpeg-2.8.2/' with_items: - make - name: Running "make install" for FFMPEG command: 'make install chdir=/myhome/ffmpeg-2.8.2/'
Nice, this worked for me. Very helpful, thankyou
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following worked for me, and stops if the .configure, make, or make install breaks! I also know that I could have just used the command function for all of them, but I was trying to learn how the with_items function works. Hope this helps someone else!