ansible常用模块之 -- make模块 – 在Makefile中运行目标
make模块 – 在Makefile中运行目标
一、摘要
- 在Makefile中运行目标
二、参数
参数 | 选项/默认值 | 描述 |
---|---|---|
chdir path required | 在运行make之前切换到此目录。 | |
file path | 使用自定义Makefile。 | |
params dictionary | 任何要传递的额外参数。 | |
target string | 要运行的目标。通常情况下,这可能是install、test或all。” |
三、示例
# 构建默认目标
- name: Build the default target
make:
chdir: /home/ubuntu/cool-project
# 以根用户身份运行“install”目标器
- name: Run 'install' target as root
make:
chdir: /home/ubuntu/cool-project
target: install
become: yes
# 用额外的参数构建'all'目标
- name: Build 'all' target with extra arguments
make:
chdir: /home/ubuntu/cool-project
target: all
params:
NUM_THREADS: 4
BACKEND: lapack
# 使用自定义Makefile构建“all”目标
- name: Build 'all' target with a custom Makefile
make:
chdir: /home/ubuntu/cool-project
target: all
file: /some-project/Makefile
官方文档: https://docs.ansible.com/ansible/2.9/modules/make_module.html#make-module