I have a C++ program hosted in Bitbucket git repository that I'm compiling with CMake. The current play can be seen below. It works fine except build
-task is run every time the play is run. Instead I'd like build
-task to run only when new software version is pulled by git-module. How I can tell in build
-task if clone
-task found new version ?
--- # tasks of role: foo - name: clone repository git: [email protected]:foo/foo.git dest={{ foo.dir }} accept_hostkey=yes - name: create build dir file: state=directory path={{ foo.build_dir }} - name: build command: "{{ item }} chdir={{ foo.build_dir }}" with_items: - cmake .. - make
You can register variable with output of clone
task and invoke build
task when state of clone
task is changed
For example:
--- # tasks of role: foo - name: clone repository git: [email protected]:foo/foo.git dest={{ foo.dir }} accept_hostkey=yes register: gitclone - name: create build dir file: state=directory path={{ foo.build_dir }} - name: build command: "{{ item }} chdir={{ foo.build_dir }}" with_items: - cmake .. - make when: gitclone.changed
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With