{"id":6624,"date":"2022-12-11T08:11:19","date_gmt":"2022-12-10T23:11:19","guid":{"rendered":"https:\/\/lab4ict.com\/system\/?p=6624"},"modified":"2023-04-23T18:08:18","modified_gmt":"2023-04-23T09:08:18","slug":"hosts%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e7%ae%a1%e7%90%86%e3%81%99%e3%82%8b%ef%bc%81","status":"publish","type":"post","link":"https:\/\/lab4ict.com\/system\/archives\/6624","title":{"rendered":"Hosts\u30d5\u30a1\u30a4\u30eb\u3092Git\u3067\u7ba1\u7406\u3059\u308b\uff01"},"content":{"rendered":"<p>\u30b7\u30b9\u30c6\u30e0\u5168\u4f53\u3067\u4f7f\u7528\u3059\u308bHosts\u30d5\u30a1\u30a4\u30eb\u3092\u7ba1\u7406\u3057\u307e\u3059\u3002Hosts\u30d5\u30a1\u30a4\u30eb\u306fAnsible\u30b5\u30fc\u30d0\u4e0a\u3067Git\u3067\u7ba1\u7406\u3057\u307e\u3059\u3002\u7ba1\u7406\u3092\u78ba\u5b9f\u306b\u3059\u308b\u305f\u3081\u306b\u3001\u30b7\u30b9\u30c6\u30e0\u7ba1\u7406\u7528\u306b\u69cb\u7bc9\u3057\u305fGitLab\u306b\u3082\u767b\u9332\u3057\u3066\u304a\u304d\u307e\u3059\u3002<br \/>\n<!--more--><\/p>\n<h2>Ansible\u306e\u30b5\u30fc\u30d0\u4e0a\u3067Hosts\u30d5\u30a1\u30a4\u30eb\u3092\u7ba1\u7406\u3059\u308b\uff01<\/h2>\n<p>Hosts\u30d5\u30a1\u30a4\u30eb\u306f\u3001Ansible\u3067\u914d\u5e03\u3059\u308b\u3053\u3068\u3092\u60f3\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002Ansible\u3092\u7a3c\u50cd\u3055\u305b\u308b\u30b5\u30fc\u30d0\u4e0a\u3067\u7ba1\u7406\u3059\u308b\u306e\u304c\u4fbf\u5229\u3060\u3068\u601d\u3044\u307e\u3059\u3002Hosts\u30d5\u30a1\u30a4\u30eb\u3092\u7ba1\u7406\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3001Hosts\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ mkdir hosts\r\n$ cp \/etc\/hosts .\r\nls -l\r\ntotal 4\r\n-rw-r--r--. 1 usradmin usradmin 3646 Dec 11 07:46 hosts\r\n<\/pre>\n<h2>\u30ed\u30fc\u30ab\u30eb\u306eGit\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u69cb\u6210\u3059\u308b\uff01<\/h2>\n<p>Git\u74b0\u5883\u306e\u521d\u671f\u8a2d\u5b9a\u3092\u884c\u3063\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u3001\u6700\u521d\u306b\u30e6\u30fc\u30b6\u306e\u60c5\u5831\u306e\u8a2d\u5b9a\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ git config --global user.email &quot;lab4ict@gmail.com&quot;\r\n$ git config --global user.name &quot;Lab4ict Webmaster&quot;\r\n<\/pre>\n<p>\u30ed\u30fc\u30ab\u30eb\u306eGit\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3001hosts\u30d5\u30a1\u30a4\u30eb\u3092\u767b\u9332\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ git init\r\n$ git add hosts\r\n$ git commit -m &quot;First Version&quot;\r\n$ git ls-files\r\nhosts\r\n<\/pre>\n<h2>GitLab\u4e0a\u306b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3059\u308b\uff01<\/h2>\n<p>GitLab\u4e0a\u306b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u4eca\u56de\u306f\u3001Configuration Management\u30b0\u30eb\u30fc\u30d7\u914d\u4e0b\u306b\u3001hosts\u3068\u3044\u3046\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002\u300cSettings\u300d\u2192\u300cRepository\u300d\u2192\u300cProtected branches\u300d\u306e\u9805\u76ee\u3067\u3001\u30ea\u30b9\u30c8\u3055\u308c\u3066\u3044\u308b\u300cmain\u300d\u30d6\u30e9\u30f3\u30c1\u306e\u300cAllowed to force push\u300d\u306e\u9805\u76ee\u3092\u6709\u52b9\u306b\u3057\u3066\u300cUnproted\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u3001push\u3092\u8a31\u53ef\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<h2>GitLab\u4e0a\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306bHosts\u30d5\u30a1\u30a4\u30eb\u3092\u767b\u9332\u3059\u308b\uff01<\/h2>\n<p>GitLab\u306eRepository\u753b\u9762\u306b\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u30b3\u30de\u30f3\u30c9\u3067\u3001Hosts\u30d5\u30a1\u30a4\u30eb\u3092\u767b\u9332\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ git remote add origin http:\/\/gitlab.lab4ict.local\/configuration-management\/hosts.git\r\n$ git branch -M main\r\n$ git push -uf origin main\r\nUsername for 'http:\/\/gitlab.lab4ict.local': root\r\nPassword for 'http:\/\/root@gitlab.lab4ict.local': \r\nEnumerating objects: 3, done.\r\nCounting objects: 100% (3\/3), done.\r\nDelta compression using up to 2 threads\r\nCompressing objects: 100% (2\/2), done.\r\nWriting objects: 100% (3\/3), 1.19 KiB | 1.19 MiB\/s, done.\r\nTotal 3 (delta 0), reused 0 (delta 0), pack-reused 0\r\nTo http:\/\/gitlab.lab4ict.local\/configuration-management\/hosts.git\r\n + 00ebaaa...0b97456 main -&gt; main (forced update)\r\nBranch 'main' set up to track remote branch 'main' from 'origin'.\r\n<\/pre>\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<p>Hosts\u30d5\u30a1\u30a4\u30eb\u306e\u7ba1\u7406\u306f\u3001\u30b7\u30b9\u30c6\u30e0\u7ba1\u7406\u306b\u304a\u3044\u3066\u91cd\u8981\u306a\u306e\u3067\u3001Git\u3067\u7ba1\u7406\u3057\u3001Ansible\u3067\u914d\u5e03\u53ef\u80fd\u306a\u7ba1\u7406\u65b9\u6cd5\u306b\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30b7\u30b9\u30c6\u30e0\u5168\u4f53\u3067\u4f7f\u7528\u3059\u308bHosts\u30d5\u30a1\u30a4\u30eb\u3092\u7ba1\u7406\u3057\u307e\u3059\u3002Hosts\u30d5\u30a1\u30a4\u30eb\u306fAnsible\u30b5\u30fc\u30d0\u4e0a\u3067Git\u3067\u7ba1\u7406\u3057\u307e\u3059\u3002\u7ba1\u7406\u3092\u78ba\u5b9f\u306b\u3059\u308b\u305f\u3081\u306b\u3001\u30b7\u30b9\u30c6\u30e0\u7ba1\u7406\u7528\u306b\u69cb\u7bc9\u3057\u305fGitLab\u306b\u3082\u767b\u9332\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":642,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[175],"tags":[],"class_list":["post-6624","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-lab4ict"],"_links":{"self":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/6624","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/comments?post=6624"}],"version-history":[{"count":1,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/6624\/revisions"}],"predecessor-version":[{"id":10487,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/6624\/revisions\/10487"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media\/642"}],"wp:attachment":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media?parent=6624"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/categories?post=6624"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/tags?post=6624"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}