{"id":42917,"date":"2023-02-11T12:29:37","date_gmt":"2024-02-27T10:13:07","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8ansible%e5%9c%a8%e6%9c%ac%e5%9c%b0%e6%89%a7%e8%a1%8c%e6%8c%89%e7%8e%af%e5%a2%83%e5%88%86%e7%a6%bb%e7%9a%84httpd-conf%e9%83%a8%e7%bd%b2%e3%80%82note-thi\/"},"modified":"2024-04-29T14:10:10","modified_gmt":"2024-04-29T06:10:10","slug":"%e6%88%91%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8ansible%e5%9c%a8%e6%9c%ac%e5%9c%b0%e6%89%a7%e8%a1%8c%e6%8c%89%e7%8e%af%e5%a2%83%e5%88%86%e7%a6%bb%e7%9a%84httpd-conf%e9%83%a8%e7%bd%b2%e3%80%82note-thi","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8ansible%e5%9c%a8%e6%9c%ac%e5%9c%b0%e6%89%a7%e8%a1%8c%e6%8c%89%e7%8e%af%e5%a2%83%e5%88%86%e7%a6%bb%e7%9a%84httpd-conf%e9%83%a8%e7%bd%b2%e3%80%82note-thi\/","title":{"rendered":"\u6211\u8bd5\u7740\u4f7f\u7528Ansible\u5728\u672c\u5730\u6267\u884c\u6309\u73af\u5883\u5206\u79bb\u7684httpd conf\u90e8\u7f72\u3002(Note: This paraphrase assumes that &#8220;\u5165\u9580\u304c\u3066\u3089&#8221; means &#8220;I tried&#8221; or &#8220;I attempted&#8221; and &#8220;\u74b0\u5883\u3054\u3068\u306e&#8221; means &#8220;separating by environment&#8221;. Additionally, it assumes you are referring to the deployment of httpd configuration files.)"},"content":{"rendered":"<h2>\u6982\u8ff0<\/h2>\n<p>\u6211\u8bd5\u7740\u4f7f\u7528Ansible\u6765\u6574\u7406\u4e00\u4e0b\u3002\u8fd9\u662f\u4e00\u4e2a\u5173\u4e8e\u5b89\u88c5\u3001\u542f\u52a8\u8bbe\u7f6e\u3001\u6309\u73af\u5883\u914d\u7f6econf\u6587\u4ef6\u3001\u6267\u884chttpd reload\u7684\u672c\u5730\u793a\u4f8b\u3002\u5f53\u670d\u52a1\u5668\u51c6\u5907\u597d\u540e\uff0c\u6211\u5e0c\u671b\u80fd\u591f\u4f7f\u7528Ansible\u4e00\u6761\u547d\u4ee4\uff08\u9644\u52a0dev\u6216stg\u9009\u9879\uff09\u6765\u5b8c\u6210\u671f\u671b\u7684\u73af\u5883\u914d\u7f6e\u3002<\/p>\n<h2>\u5f15\u5165\u7f16\u5236<\/h2>\n<h3>\u6536\u96c6\u57fa\u790e\u77e5\u8b58<\/h3>\n<p>\u6211\u901a\u8fc7\u641c\u7d22\u201cansible \u5165\u95e8\u201d\u6765\u9605\u8bfb\u4e86\u51e0\u7bc7\u6587\u7ae0<br \/>\nAnsible \u5165\u95e8 &#8211; Qiita<br \/>\n\u8bd5\u7740\u7528 Ansible \u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684 LAMP \u73af\u5883 &#8211; yk5656 \u65e5\u8bb0<br \/>\n\u4f7f\u7528 Role \u7684 Ansible \u6559\u7a0b | Developers.IO<\/p>\n<p>\u81f3\u5c11\u6709\u4ee5\u4e0b\u7684\u4e1c\u897f\u4f3c\u4e4e\u5c31\u591f\u4e86\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ansible\u74b0\u5883<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Inventory\u30d5\u30a1\u30a4\u30eb(\u30b5\u30fc\u30d0\u60c5\u5831\u304c\u8a18\u8f09\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb)<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">playbook\u30d5\u30a1\u30a4\u30eb(\u30bf\u30b9\u30af\u60c5\u5831\u304c\u304b\u304b\u308c\u305f\u30d5\u30a1\u30a4\u30eb)<\/ul>\n<p>\u80fd\u5426\u901a\u8fc7\u67d0\u79cd\u65b9\u5f0f\u7701\u7565Inventory\u6587\u4ef6\uff0c\u5e76\u4ee5\u4e00\u4e2a\u6587\u4ef6\u6765\u7ba1\u7406\u5462\uff1f\u6211\u52aa\u529b\u5c1d\u8bd5\u4e86\u4e00\u4e0b\uff0c\u4f46\u65e0\u6cd5\u91cd\u73b0\uff0c\u5e76\u4e14\u4f3c\u4e4e\u4e5f\u4e0d\u88ab\u63a8\u8350\u3002\uff08\u662f\u5426\u53ef\u4ee5\u50cfFabric\u90a3\u6837\uff0c\u5728\u6267\u884c\u547d\u4ee4\u65f6\u901a\u8fc7\u9009\u9879\u6765\u89e3\u51b3\u5462\uff1f\uff09<\/p>\n<p>\u4f3c\u4e4e\u6709\u4e00\u4e9b\u4f8b\u5b50\u3002 \u3010Ansible\u3011\u4e0d\u4f7f\u7528Inventory\u6587\u4ef6\u6267\u884cansible\u547d\u4ee4 \uff5c Developers.IO<\/p>\n<h3>\u5b89\u88c5<\/h3>\n<p>\u5b89\u88c5\u53ef\u901a\u8fc7yum\u6216sudo\u8fdb\u884c\u3002\u672c\u5730\u73af\u5883\u4f7f\u7528pyenv+virtualenv\u6765\u5207\u6362\u76ee\u5f55\u73af\u5883\uff0c\u56e0\u6b64\u4ecepip\u4e2d\u5f15\u5165\u4e86\u4f9d\u8d56\u3002<\/p>\n<pre class=\"post-pre\"><code>\r\n# yum\u304b\u3089\r\n$ sudo yum install epel-release\r\n$ sudo yum install ansible\r\n# \u3053\u3063\u3061\u3060\u3068\u5f8c\u8ff0\u306eInventory\u30d5\u30a1\u30a4\u30eb(\/etc\/ansible\/hosts)\u306f\u81ea\u524d\u3067\u3067\u304d\u308b\u3089\u3057\u3044\r\n\r\n# pip\u304b\u3089(python\u4e8b\u524d\u306b\u74b0\u5883\u3042\u308b\u524d\u63d0)\r\n$ pip install ansible\r\n\r\n<\/code><\/pre>\n<h2>\u8bd5\u4e00\u8bd5<\/h2>\n<p>\u51c6\u5907Inventory\u6587\u4ef6\uff08\u636e\u8bf4\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5c06\u8bfb\u53d6\/etc\/ansible\/hosts\u6587\u4ef6\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code>\r\n[all]\r\nlocalhosts ansible_connection=local\r\n\r\n<\/code><\/pre>\n<p>\u51c6\u5907Playbook<\/p>\n<pre class=\"post-pre\"><code>---\r\n- hosts: localhosts\r\n  sudo: yes\r\n  tasks:\r\n  - name: install httpd\r\n    yum: name=httpd state=present\r\n  - name: start httpd service\r\n    service: name=httpd state=started enabled=yes\r\n  - name: setup stg conf file\r\n    template: src=stg-hoge.j2 dest=\/etc\/httpd\/conf.d\/hoge.conf\r\n    notify: httpd restart\r\n    when: conf_env == \"stg\"\r\n  - name: setup dev conf file\r\n    template: src=dev-hoge.j2 dest=\/etc\/httpd\/conf.d\/hoge.conf\r\n    notify: httpd restart\r\n    when: conf_env == \"dev\"\r\n  - name: httpd start confirm\r\n    wait_for: port=80 delay=1\r\n  handlers:\r\n    - name: httpd restart\r\n      action: service name=httpd state=reloaded\r\n<\/code><\/pre>\n<p>\u51c6\u5907\u6bcf\u4e2a\u73af\u5883\u7684\u914d\u7f6e\u6587\u4ef6\u6a21\u677f\u3002\uff08\u8fd9\u6b21\u662f\u793a\u4f8b\uff0c\u6240\u4ee5\u65e0\u8bba\u4ec0\u4e48\u90fd\u53ef\u4ee5\uff09<\/p>\n<pre class=\"post-pre\"><code># \/home\/hoge\/ansible\u4ee5\u4e0b\u306b\u305d\u308c\u305e\u308c\r\n$ cat dev-hoge.j2\r\n&lt;VirtualHost *:80&gt;\r\n  DocumentRoot \/www\/public\/dev-html\r\n  ServerName www.example.com\r\n&lt;\/VirtualHost&gt;\r\n$ cat stg-hoge.j2\r\n&lt;VirtualHost *:80&gt;\r\n  DocumentRoot \/www\/public\/stg-html\r\n  ServerName www.example.com\r\n&lt;\/VirtualHost&gt;\r\n\r\n<\/code><\/pre>\n<p>\u5c1d\u8bd5\u6267\u884c<\/p>\n<pre class=\"post-pre\"><code>\r\n# \u3069\u306eplaybook\u3092\u5b9f\u884c\u3059\u308b\u304b\u3001sudo\u30d1\u30b9\u3092\u8a0a\u304f\u304b?\u3001\u5b9f\u884c\u5909\u6570\u6307\u5b9a\u3001Inventory\u30d5\u30a1\u30a4\u30eb\u6307\u5b9a\u3057\u3066\u308b\r\n$ ansible-playbook main.yaml --ask-sudo-pass --extra-vars \"conf_env=stg\" -i hosts\r\n\r\nSUDO password:\r\n\r\nPLAY [localhosts] *************************************************************\r\n\r\nGATHERING FACTS ***************************************************************\r\nok: [localhosts]\r\n\r\nTASK: [install httpd] *********************************************************\r\nok: [localhosts]\r\n\r\nTASK: [start httpd service] ***************************************************\r\nok: [localhosts]\r\n\r\nTASK: [setup stg conf file] ***************************************************\r\nok: [localhosts]\r\n\r\nTASK: [setup dev conf file] ***************************************************\r\nskipping: [localhosts]\r\n\r\nTASK: [httpd start confirm] ***************************************************\r\nok: [localhosts]\r\n\r\nPLAY RECAP ********************************************************************\r\nlocalhosts                 : ok=5    changed=0    unreachable=0    failed=0\r\n\r\n$ ansible-playbook main.yaml --ask-sudo-pass --extra-vars \"conf_env=dev\" -i hosts\r\nSUDO password:\r\n\r\nPLAY [localhosts] *************************************************************\r\n\r\nGATHERING FACTS ***************************************************************\r\nok: [localhosts]\r\n\r\nTASK: [install httpd] *********************************************************\r\nok: [localhosts]\r\n\r\nTASK: [start httpd service] ***************************************************\r\nok: [localhosts]\r\n\r\nTASK: [setup stg conf file] ***************************************************\r\nskipping: [localhosts]\r\n\r\nTASK: [setup dev conf file] ***************************************************\r\nok: [localhosts]\r\n\r\nTASK: [httpd start confirm] ***************************************************\r\nok: [localhosts]\r\n\r\nPLAY RECAP ********************************************************************\r\nlocalhosts                 : ok=5    changed=0    unreachable=0    failed=0\r\n\r\n<\/code><\/pre>\n<p>\u56e0\u4e3a\u5728\u547d\u4ee4\u6267\u884c\u65f6\u901a\u8fc7\u9009\u9879\u6307\u5b9a\u4e86\u662fdev\u8fd8\u662fstg\uff0c\u6240\u4ee5\u4e00\u5207\u987a\u5229\u3002<\/p>\n<h2>\u5173\u4e8ePlaybook\u7684\u8bf4\u660e<\/h2>\n<h3>\u8fd9\u6b21\u505a\u8fc7\u7684\u4e8b\u60c5<\/h3>\n<p>\u5728\u540d\u4e3a&#8221;hosts&#8221;\u7684\u73af\u5883\u5355\u4f4d\u4e2d\uff0c\u6267\u884c\u4e0e\u8be5\u73af\u5883\u5355\u4f4d\u76f8\u5173\u7684&#8221;tasks&#8221;\u3002<\/p>\n<p>\u5728\u201chosts\u201d\u6587\u4ef6\u4e2d\uff0c\u53ef\u4ee5\u6307\u5b9a\u662f\u5426\u901a\u8fc7sudo\u6765\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n<pre class=\"post-pre\"><code># localhosts\u306bsudo\u3067\u5b9f\u884c\u3059\u308b\r\n- hosts: localhosts\r\n  sudo: yes\r\n<\/code><\/pre>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">&#8220;tasks&#8221;\u306b\u306f&#8221;name&#8221;\u3054\u3068\u5404\u30bf\u30b9\u30af\u306b\u540d\u524d\u3092\u3064\u3051\u3066\u3001\u305d\u306e\u4e0b\u306b\u5b9f\u969b\u306e\u6240\u671b\u306e\u72b6\u614b\u3092\u8a18\u8f09\u3059\u308b\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>\u3053\u308c\u3089\u3092module\u3068\u547c\u3073\u3001\u4eca\u56de\u306fyum\u3001service\u3001template\u3001wait_for\u306a\u3069\u5229\u7528<br \/>\n\u53c2\u8003:All Modules \u2014 Ansible Documentation<\/p>\n<pre class=\"post-pre\"><code># httpd\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u30d7\u30ed\u30bb\u30b9\u8d77\u52d5\u3068\u81ea\u52d5\u8d77\u52d5\u3092\u6709\u52b9\u306b\u3059\u308b\u307e\u3067\r\n  tasks:\r\n  - name: install httpd\r\n    yum: name=httpd state=present\r\n  - name: start httpd service\r\n    service: name=httpd state=started enabled=yes\r\n  ...\r\n<\/code><\/pre>\n<p>\u5728\u6a21\u677f\u4e2d\uff0c\u901a\u8fc7jinja2\u7684\u6587\u4ef6(.j2)\u8fdb\u884c\u5f15\u7528\u3002<br \/>\n\u5728\u5176\u4e0b\u65b9\uff0c\u53ef\u4ee5\u4f7f\u7528notify\u6765\u6307\u5b9a\u5728\u8be5\u4efb\u52a1\u53d1\u751f\u66f4\u6539\u65f6\u7684\u4e0b\u4e00\u4e2a\u4efb\u52a1\uff0c\u6216\u8005\u4f7f\u7528when\u6765\u6307\u5b9a\u5728\u54ea\u79cd\u60c5\u51b5\u4e0b\u6267\u884c\u5206\u652f\u3002<\/p>\n<pre class=\"post-pre\"><code>### stg\u306e\u5834\u5408\u306econf\u914d\u7f6e\r\n  - name: setup stg conf file\r\n    template: src=stg-hoge.j2 dest=\/etc\/httpd\/conf.d\/hoge.conf\r\n    notify: httpd restart\r\n    when: conf_env == \"stg\"\r\n\r\n<\/code><\/pre>\n<p>\u53ea\u9700\u8981\u4e00\u79cd\u65b9\u5f0f\uff0c\u5bf9\u4ee5\u4e0b\u5185\u5bb9\u8fdb\u884c\u4e2d\u6587\u672c\u5730\u5316\u6539\u5199\uff1a<br \/>\n\u901a\u8fc7notify\u6307\u5b9a\u7684&#8221;httpd restart&#8221;\u88ab\u6307\u5b9a\u4e3a\u5904\u7406\u7a0b\u5e8f\uff0c\u7c7b\u4f3c\u4e8e\u52a9\u624b\u4efb\u52a1\u3002<\/p>\n<pre class=\"post-pre\"><code># handler\u3068\u3057\u3066\"httpd restart\"\u3092\u5b9a\u7fa9\r\n  handlers:\r\n    - name: httpd restart\r\n      action: service name=httpd state=reloaded\r\n\r\n<\/code><\/pre>\n<h3>\u672a\u6765\u53ef\u80fd\u5b9e\u73b0\u7684\u4e8b\u60c5<\/h3>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">main.yaml\u306e\u4e2d\u306bvars\u3067\u5909\u6570\u3082\u57cb\u3081\u8fbc\u3081\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">main.yaml\u306f\u5404task\u3092\u5225\u30d5\u30a1\u30a4\u30eb\u306b\u3057\u3066inculude\u3057\u3066\u518d\u5229\u7528\u6027\u3092\u3042\u3052\u3089\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">role\u3067chef\u3063\u307d\u304f\u898f\u7d04\u306b\u5f93\u3063\u305f\u30d5\u30a1\u30a4\u30eb\u69cb\u9020\u306b\u3059\u308c\u3070\u81ea\u52d5\u3067\u8aad\u307f\u8fbc\u3093\u3067\u304f\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">module\u306fbash\u3068\u304b\u3067\u81ea\u4f5c\u3082\u3067\u304d\u308b\u3089\u3057\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">chef\u306edatabag\u7684\u306a\u306e\u306fVault\u3068\u3044\u3046\u306e\u3092\u4f7f\u3048\u3070\u3044\u3044\u3089\u3057\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">sudo\u3058\u3083\u306a\u304f\u3066root\u3058\u3083\u306a\u3044\u3068\u5b9f\u884c\u3067\u304d\u306a\u3044\u3001\u3068\u304b\u3044\u3046\u60b2\u3057\u3044\u74b0\u5883\u3067\u3082\u3067\u304d\u308b\u3063\u307d\u3044<\/ul>\n<p>\u53c2\u8003\uff1a\u4f7f\u7528Ansible\u7684Playbook- akishin999\u7684\u65e5\u5fd7<br \/>\nAnsible\u6a21\u5757\u5f00\u53d1\u4e4b\u9053- Nulab\u516c\u53f8<br \/>\n\u4f7f\u7528ansible\u8fdb\u884c\u5bc6\u7801\u8ba4\u8bc1\u548c\u4ee5root\u8eab\u4efd\u6267\u884c\u547d\u4ee4- Qiita<\/p>\n<h2>\u611f\u53d7\u4e4b\u5904<\/h2>\n<p>\u867d\u7136\u80fd\u591f\u8fc5\u901f\u5b8c\u6210\u60f3\u505a\u7684\u4e8b\u60c5\uff0c\u4f46\u7531\u4e8e\u6211\u76ee\u524d\u4ec5\u5904\u4e8e\u5165\u95e8\u7ea7\u522b\uff0c\u6240\u4ee5\u672a\u6765\u7684\u53d1\u5c55\u8fd8\u4e0d\u786e\u5b9a\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u3044\u3044?\u3068\u3053\u308d<\/ul>\n<\/li>\n<\/ul>\n<p>2\u30d5\u30a1\u30a4\u30eb\u3068\u304b\u6700\u5c0f\u3067\u3067\u304d\u308b\u306e\u306f\u3088\u3044<br \/>\nchef\u306e\u69d8\u306b\u8b0e\u30b3\u30de\u30f3\u30c9\u305f\u304f\u3055\u3093\u3067\u6df7\u4e71\u3057\u306a\u3044?(ansible\u3068ansible-playbook\u30b3\u30de\u30f3\u30c9\u3068\u304b\u3042\u308b\u3051\u3069&#8230;)<\/p>\n<p>\u308f\u308b\u3044?\u3068\u3053\u308d<\/p>\n<p>Inventory\u30d5\u30a1\u30a4\u30eb\u306f\u3084\u3063\u3071\u308a\u7701\u7565\u53ef\u80fd\u306b\u3057\u3066\u6b32\u3057\u3044<br \/>\n\u7d50\u679c\u304c&#8221;OK&#8221;\u3060\u3051\u3067\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u3002\u30d5\u30a1\u30a4\u30eb\u5909\u66f4\u3057\u305f\u3089\u5dee\u5206\u3068\u304b\u6b32\u3057\u3044\u3002<br \/>\n\u5c0f\u898f\u6a21\u306f\u6c17\u697d\u3060\u3051\u3069\u3001\u3084\u3063\u3071\u5927\u898f\u6a21\u3060\u3068\u5927\u4e08\u592b\u304b\u306a?\u611f<br \/>\n(ansible\u95a2\u4fc2\u306a\u3044\u3051\u3069)\u3067\u304d\u305f\u30b3\u30fc\u30c9\u306fgit\u306a\u308a\u3067\u3069\u3046\u7ba1\u7406\u3059\u308b\u3068\u904b\u7528\u4fbf\u5229\u304b\u306a?\u3068\u3075\u3068<\/p>\n<p>\u4eca\u56de\u306a\u305cchef\u3092\u4f7f\u308f\u306a\u3044\u304b?<\/p>\n<p>\u30d5\u30a1\u30a4\u30eb\u69cb\u6210\u3068\u304b\u8907\u96d1\u306a\u306e\u3067\u7c21\u5358\u306b\u59cb\u3081\u308b\u306a\u30891\u30d5\u30a1\u30a4\u30eb\u3067\u69cb\u6210\u3092\u7ba1\u7406\u3057\u305f\u304b\u3063\u305f(\u3067\u304d\u306a\u304b\u3063\u305f\u3051\u3069)<br \/>\n\u5358\u7d14\u306bruby\u3088\u308apython\u306e\u304c\u8003\u3048\u65b9\u304c\u6163\u308c\u3066\u308b\u304b\u3089<br \/>\nchef\u3070\u3063\u304b\u308a\u3060\u3068\u3042\u308c\u306a\u306e\u3067\u3001\u4ed6\u306e\u306b\u3082\u624b\u3092\u51fa\u3057\u3068\u3044\u305f\u65b9\u304c\u982d\u306e\u4f53\u64cd\u7684\u306b\u306f\u3044\u3044\u304b\u306a\u3068<\/p>\n<p>\u524d\u9762\u6240\u8ff0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8ff0 \u6211\u8bd5\u7740\u4f7f\u7528Ansible\u6765\u6574\u7406\u4e00\u4e0b\u3002\u8fd9\u662f\u4e00\u4e2a\u5173\u4e8e\u5b89\u88c5\u3001\u542f\u52a8\u8bbe\u7f6e\u3001\u6309\u73af\u5883\u914d\u7f6econf\u6587\u4ef6\u3001\u6267\u884chttpd  [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-42917","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u6211\u8bd5\u7740\u4f7f\u7528Ansible\u5728\u672c\u5730\u6267\u884c\u6309\u73af\u5883\u5206\u79bb\u7684httpd conf\u90e8\u7f72\u3002(Note: This paraphrase assumes that &quot;\u5165\u9580\u304c\u3066\u3089&quot; means &quot;I tried&quot; or &quot;I attempted&quot; and &quot;\u74b0\u5883\u3054\u3068\u306e&quot; means &quot;separating by environment&quot;. Additionally, it assumes you are referring to the deployment of httpd configuration files.) - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u6211\u8bd5\u7740\u4f7f\u7528ansible\u5728\u672c\u5730\u6267\u884c\u6309\u73af\u5883\u5206\u79bb\u7684httpd-conf\u90e8\u7f72\u3002note-thi\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u6211\u8bd5\u7740\u4f7f\u7528Ansible\u5728\u672c\u5730\u6267\u884c\u6309\u73af\u5883\u5206\u79bb\u7684httpd conf\u90e8\u7f72\u3002(Note: This paraphrase assumes that &quot;\u5165\u9580\u304c\u3066\u3089&quot; means &quot;I tried&quot; or &quot;I attempted&quot; and &quot;\u74b0\u5883\u3054\u3068\u306e&quot; means &quot;separating by environment&quot;. Additionally, it assumes you are referring to the deployment of httpd configuration files.)\" \/>\n<meta property=\"og:description\" content=\"\u6982\u8ff0 \u6211\u8bd5\u7740\u4f7f\u7528Ansible\u6765\u6574\u7406\u4e00\u4e0b\u3002\u8fd9\u662f\u4e00\u4e2a\u5173\u4e8e\u5b89\u88c5\u3001\u542f\u52a8\u8bbe\u7f6e\u3001\u6309\u73af\u5883\u914d\u7f6econf\u6587\u4ef6\u3001\u6267\u884chttpd [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u6211\u8bd5\u7740\u4f7f\u7528ansible\u5728\u672c\u5730\u6267\u884c\u6309\u73af\u5883\u5206\u79bb\u7684httpd-conf\u90e8\u7f72\u3002note-thi\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-27T10:13:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-29T06:10:10+00:00\" \/>\n<meta name=\"author\" content=\"\u6e05, \u626c\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6e05, \u626c\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8ansible%e5%9c%a8%e6%9c%ac%e5%9c%b0%e6%89%a7%e8%a1%8c%e6%8c%89%e7%8e%af%e5%a2%83%e5%88%86%e7%a6%bb%e7%9a%84httpd-conf%e9%83%a8%e7%bd%b2%e3%80%82note-thi\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8ansible%e5%9c%a8%e6%9c%ac%e5%9c%b0%e6%89%a7%e8%a1%8c%e6%8c%89%e7%8e%af%e5%a2%83%e5%88%86%e7%a6%bb%e7%9a%84httpd-conf%e9%83%a8%e7%bd%b2%e3%80%82note-thi\/\",\"name\":\"\u6211\u8bd5\u7740\u4f7f\u7528Ansible\u5728\u672c\u5730\u6267\u884c\u6309\u73af\u5883\u5206\u79bb\u7684httpd conf\u90e8\u7f72\u3002(Note: This paraphrase assumes that \\\"\u5165\u9580\u304c\u3066\u3089\\\" means \\\"I tried\\\" or \\\"I attempted\\\" and \\\"\u74b0\u5883\u3054\u3068\u306e\\\" means \\\"separating by environment\\\". Additionally, it assumes you are referring to the deployment of httpd configuration files.) - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2024-02-27T10:13:07+00:00\",\"dateModified\":\"2024-04-29T06:10:10+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/cb5556d2501da73d864cac945e8d9461\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8ansible%e5%9c%a8%e6%9c%ac%e5%9c%b0%e6%89%a7%e8%a1%8c%e6%8c%89%e7%8e%af%e5%a2%83%e5%88%86%e7%a6%bb%e7%9a%84httpd-conf%e9%83%a8%e7%bd%b2%e3%80%82note-thi\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8ansible%e5%9c%a8%e6%9c%ac%e5%9c%b0%e6%89%a7%e8%a1%8c%e6%8c%89%e7%8e%af%e5%a2%83%e5%88%86%e7%a6%bb%e7%9a%84httpd-conf%e9%83%a8%e7%bd%b2%e3%80%82note-thi\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8ansible%e5%9c%a8%e6%9c%ac%e5%9c%b0%e6%89%a7%e8%a1%8c%e6%8c%89%e7%8e%af%e5%a2%83%e5%88%86%e7%a6%bb%e7%9a%84httpd-conf%e9%83%a8%e7%bd%b2%e3%80%82note-thi\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6211\u8bd5\u7740\u4f7f\u7528Ansible\u5728\u672c\u5730\u6267\u884c\u6309\u73af\u5883\u5206\u79bb\u7684httpd conf\u90e8\u7f72\u3002(Note: This paraphrase assumes that &#8220;\u5165\u9580\u304c\u3066\u3089&#8221; means &#8220;I tried&#8221; or &#8220;I attempted&#8221; and &#8220;\u74b0\u5883\u3054\u3068\u306e&#8221; means &#8220;separating by environment&#8221;. Additionally, it assumes you are referring to the deployment of httpd configuration files.)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/cb5556d2501da73d864cac945e8d9461\",\"name\":\"\u6e05, \u626c\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/32a4239de8ff29adace466261d309424a1e5fe9f7e3036bf89fe03f2e3dbe717?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/32a4239de8ff29adace466261d309424a1e5fe9f7e3036bf89fe03f2e3dbe717?s=96&d=mm&r=g\",\"caption\":\"\u6e05, \u626c\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyang\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8ansible%e5%9c%a8%e6%9c%ac%e5%9c%b0%e6%89%a7%e8%a1%8c%e6%8c%89%e7%8e%af%e5%a2%83%e5%88%86%e7%a6%bb%e7%9a%84httpd-conf%e9%83%a8%e7%bd%b2%e3%80%82note-thi\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u6211\u8bd5\u7740\u4f7f\u7528Ansible\u5728\u672c\u5730\u6267\u884c\u6309\u73af\u5883\u5206\u79bb\u7684httpd conf\u90e8\u7f72\u3002(Note: This paraphrase assumes that \"\u5165\u9580\u304c\u3066\u3089\" means \"I tried\" or \"I attempted\" and \"\u74b0\u5883\u3054\u3068\u306e\" means \"separating by environment\". Additionally, it assumes you are referring to the deployment of httpd configuration files.) - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u6211\u8bd5\u7740\u4f7f\u7528ansible\u5728\u672c\u5730\u6267\u884c\u6309\u73af\u5883\u5206\u79bb\u7684httpd-conf\u90e8\u7f72\u3002note-thi\/","og_locale":"zh_CN","og_type":"article","og_title":"\u6211\u8bd5\u7740\u4f7f\u7528Ansible\u5728\u672c\u5730\u6267\u884c\u6309\u73af\u5883\u5206\u79bb\u7684httpd conf\u90e8\u7f72\u3002(Note: This paraphrase assumes that \"\u5165\u9580\u304c\u3066\u3089\" means \"I tried\" or \"I attempted\" and \"\u74b0\u5883\u3054\u3068\u306e\" means \"separating by environment\". Additionally, it assumes you are referring to the deployment of httpd configuration files.)","og_description":"\u6982\u8ff0 \u6211\u8bd5\u7740\u4f7f\u7528Ansible\u6765\u6574\u7406\u4e00\u4e0b\u3002\u8fd9\u662f\u4e00\u4e2a\u5173\u4e8e\u5b89\u88c5\u3001\u542f\u52a8\u8bbe\u7f6e\u3001\u6309\u73af\u5883\u914d\u7f6econf\u6587\u4ef6\u3001\u6267\u884chttpd [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u6211\u8bd5\u7740\u4f7f\u7528ansible\u5728\u672c\u5730\u6267\u884c\u6309\u73af\u5883\u5206\u79bb\u7684httpd-conf\u90e8\u7f72\u3002note-thi\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2024-02-27T10:13:07+00:00","article_modified_time":"2024-04-29T06:10:10+00:00","author":"\u6e05, \u626c","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u6e05, \u626c","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8ansible%e5%9c%a8%e6%9c%ac%e5%9c%b0%e6%89%a7%e8%a1%8c%e6%8c%89%e7%8e%af%e5%a2%83%e5%88%86%e7%a6%bb%e7%9a%84httpd-conf%e9%83%a8%e7%bd%b2%e3%80%82note-thi\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8ansible%e5%9c%a8%e6%9c%ac%e5%9c%b0%e6%89%a7%e8%a1%8c%e6%8c%89%e7%8e%af%e5%a2%83%e5%88%86%e7%a6%bb%e7%9a%84httpd-conf%e9%83%a8%e7%bd%b2%e3%80%82note-thi\/","name":"\u6211\u8bd5\u7740\u4f7f\u7528Ansible\u5728\u672c\u5730\u6267\u884c\u6309\u73af\u5883\u5206\u79bb\u7684httpd conf\u90e8\u7f72\u3002(Note: This paraphrase assumes that \"\u5165\u9580\u304c\u3066\u3089\" means \"I tried\" or \"I attempted\" and \"\u74b0\u5883\u3054\u3068\u306e\" means \"separating by environment\". Additionally, it assumes you are referring to the deployment of httpd configuration files.) - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2024-02-27T10:13:07+00:00","dateModified":"2024-04-29T06:10:10+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/cb5556d2501da73d864cac945e8d9461"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8ansible%e5%9c%a8%e6%9c%ac%e5%9c%b0%e6%89%a7%e8%a1%8c%e6%8c%89%e7%8e%af%e5%a2%83%e5%88%86%e7%a6%bb%e7%9a%84httpd-conf%e9%83%a8%e7%bd%b2%e3%80%82note-thi\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8ansible%e5%9c%a8%e6%9c%ac%e5%9c%b0%e6%89%a7%e8%a1%8c%e6%8c%89%e7%8e%af%e5%a2%83%e5%88%86%e7%a6%bb%e7%9a%84httpd-conf%e9%83%a8%e7%bd%b2%e3%80%82note-thi\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8ansible%e5%9c%a8%e6%9c%ac%e5%9c%b0%e6%89%a7%e8%a1%8c%e6%8c%89%e7%8e%af%e5%a2%83%e5%88%86%e7%a6%bb%e7%9a%84httpd-conf%e9%83%a8%e7%bd%b2%e3%80%82note-thi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u6211\u8bd5\u7740\u4f7f\u7528Ansible\u5728\u672c\u5730\u6267\u884c\u6309\u73af\u5883\u5206\u79bb\u7684httpd conf\u90e8\u7f72\u3002(Note: This paraphrase assumes that &#8220;\u5165\u9580\u304c\u3066\u3089&#8221; means &#8220;I tried&#8221; or &#8220;I attempted&#8221; and &#8220;\u74b0\u5883\u3054\u3068\u306e&#8221; means &#8220;separating by environment&#8221;. Additionally, it assumes you are referring to the deployment of httpd configuration files.)"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/cb5556d2501da73d864cac945e8d9461","name":"\u6e05, \u626c","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/32a4239de8ff29adace466261d309424a1e5fe9f7e3036bf89fe03f2e3dbe717?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/32a4239de8ff29adace466261d309424a1e5fe9f7e3036bf89fe03f2e3dbe717?s=96&d=mm&r=g","caption":"\u6e05, \u626c"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyang\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8ansible%e5%9c%a8%e6%9c%ac%e5%9c%b0%e6%89%a7%e8%a1%8c%e6%8c%89%e7%8e%af%e5%a2%83%e5%88%86%e7%a6%bb%e7%9a%84httpd-conf%e9%83%a8%e7%bd%b2%e3%80%82note-thi\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/42917","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=42917"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/42917\/revisions"}],"predecessor-version":[{"id":85738,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/42917\/revisions\/85738"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=42917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=42917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=42917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}